The following steps recreate an issue I'm having with data unloaded from Redshift, and I'm trying to figure out if there's a way to get it to load without modifying the extract from Redshift.
create table finicity (w char(3), x int, y datetime, z int) ;
--we're using E'\001' as a delimiter
\o test.txt
select '"abc"' || E'\001' || '"123"' || E'\001' || '"' || current_timestamp || '"' || E'\001' || '"' || '' || '"' from vendor_dimension;
-- I'm joining to vendor_dimension just to get 50-ish rows for testing purposes.
copy finicity
from 'test.txt'
DELIMITER E'\001'
ENCLOSED BY '"'
rejected data as table finicity_rejects
DIRECT ;
Rows Loaded
0
I'm getting this error:
Invalid integer format '' for column 4 (z)
The data:
"abc"^A"123"^A"2018-11-10 04:59:15.241563+00"^A""
It seems to be interpreting column 4 as a string literal, and not a null. Is there a way to force this? I can't find a solution to this. I tried about 20 different ways to modify that 4th field, and I just get errors like:
COPY: Expression for column z cannot be coerced
