python - Redshift 创建一个带有静态字符串错误的新列
问题描述
我的查询是如何实现的我使用一个语句SELECT 'ChickenMongoose' as animal
来创建一个带有静态单词“ChickenMongoose”的新列但是我从 redshift 中得到这个错误Value too long for type character varying(7)
如何创建一个带有静态字符串的新列来适应这个长度?
更多上下文:
UNION ALL
(SELECT 'ChickenMongoose' as animal ,
SUM(COALESCE(friends.touches, 0)) AS touches
FROM
basic t
INNER JOIN
mock_friends friends ON friends.initiative_id = t.initiative_id
WHERE
'ChickenMongoose' in ('ChickenMongoose', 'potato')
基本上我的查询与联合 ALLS 连接,顶部有一个 select 语句,它不允许我将 ChickenMongoose 分配为动物列下的静态名称
谢谢
解决方案
在 Redshift 中,尝试将最后一行替换
'ChickenMongoose' in ('ChickenMongoose', 'potato')
为
animal in ('ChickenMongoose', 'potato')
因为它会将其视为非整数字符常量
推荐阅读
- javascript - 将 php 数组中的注册错误显示为模态
- c - 为什么这个短程序会产生这个输出?
- facebook - 如何使用页面范围 id PSID 生成用于在 Facebook 页面中与用户聊天的 URL
- kernel - kaggle中的提交时间和运行代码的时间一样吗?
- svg - SVG 路径“填充”的颜色超出预期
- c - Makefile 无法构建内核模块“配方在第一个目标之前开始”
- c++ - Openssl RSA_new() 和内存泄漏检测
- javascript - 如何使用javascript修复图像路径上的工具提示“悬停文本”
- java - 文本相似度搜索算法
- php - 如何使用自定义名称创建动态网页?