【发布时间】:2014-08-12 16:06:43
【问题描述】:
我有一个名为压缩的表,其中列出了每个项目的初始大小和压缩大小。
我想要一个查询,显示迄今为止存储的最佳压缩率,例如:
select max(
cast(uncompressed_size as int) -
cast(compressed_size as int)
)
from compression
问题是,由于这个错误,这段代码不会执行:
ERROR: Invalid digit, Value '2', Pos 0, Type: Integer
Detail:
-----------------------------------------------
error: Invalid digit, Value '2', Pos 0, Type: Integer
code: 1207
context:
query: 362794
location: :0
process: query0_21 [pid=0]
-----------------------------------------------
选角肯定有问题,但我不确定是什么原因造成的。
这是一个 postgres 数据库(技术上是亚马逊红移),我真的很困惑为什么这样的操作可能会失败。
【问题讨论】:
-
为什么将尺寸存储为字符而不是数字?
-
我只有这个数据库的读取权限。
-
uncompressed_size和compressed_size列的格式类型是什么?我可以在我的 Redshift 集群上使用“字符”类型运行您的查询。
标签: sql database postgresql amazon-redshift