Saurabh Singh
Saurabh Singh

Reputation: 11

Cannot see "Null" value in Redshift table column

I have a table in redshift with following columns in create statement

ExpiryDate Timestamp without time zone          NULL Encode zstd,
IssueDate Timestamp without time zone           NULL Encode zstd,
RewardNumber varchar(64)                        NULL Encode zstd,
VoucherIdentifier varchar(64)                   NULL Encode zstd

Once I insert data into my table I can see NULL value for "ExpiryDate" and "IssueDate" but I have no clue why I am not able to see any NULL value for "RewardNumber" and "VoucherIdentifier". It simply shows blank for the two columns. I am using DBvisualizer to connect to redshift.

See Screenshot of my DBVisualizer

Am I doing something wrong when I am creating my tables

Upvotes: 1

Views: 5519

Answers (1)

MikeJRamsey56
MikeJRamsey56

Reputation: 2819

COPY has an optional parameter EMPTYASNULL.

Indicates that Amazon Redshift should load empty CHAR and VARCHAR fields as NULL. Empty fields for other data types, such as INT, are always loaded with NULL. Empty fields occur when data contains two delimiters in succession with no characters between the delimiters. EMPTYASNULL and NULL AS '' (empty string) produce the same behavior.

My hypothesis is that you didn't specify that option when loading your table.

Reference Data Conversion Parameters

Upvotes: 1

Related Questions