I created a table in AWS Redshift such as
CREATE TABLE exampleTableName ( id int identity(1,1), accId varchar(16) encode zstd, amount float4, primary key(id) ) distkey(accId) interleaved sortkey(accId);
An example record in the table has the
amount field's value as
However, when I try to export the data by performing an UNLOAD, the resulting file (essentially a CSV) has additional precision for the field value.
The unload command:
UNLOAD ('SELECT * from exampleTableName') TO 's3://bucket/prefixFile_' IAM_ROLE 'XXX' HEADER ADDQUOTES PARALLEL OFF MAXFILESIZE AS 5gb DELIMITER AS ',' GZIP;
The field value in the resulting output:
120.120003 (i.e. it has added 4 more decimal places, that aren't in the original dataset).
Why is this happening, and how can I prevent the additional precision (i.e. decimal places) from being output as part of the UNLOAD command?