插入到redshift时,decimal被截断了

时间:2014-04-29 08:41:37

标签: postgresql amazon-redshift

我在redshift数据库中创建了一个表,比如

CREATE TABLE abc (
   "field1"              decimal(8,3)
)

然后我尝试运行以下SQL

insert into abc ("field1") values (666.666);

但最后我发现表中的值变为666.66

请帮忙。

2 个答案:

答案 0 :(得分:11)

我终于得到了答案。

我在SQL客户端使用Workbench,默认只显示2位小数。我必须在选项设置中更改它。

答案 1 :(得分:1)

要更改两位小数的默认值,请更改SQLWorkbench的数据格式。这可以通过

来实现
Preferences -> Data Formatting -> Decimal digits -> to 3 (based on the above example). 
相关问题