Why doesn't ACCEPTINVCHARS work here?

独自空忆成欢 提交于 2020-01-03 04:54:06

问题


I'm getting load errors when trying to load data into Redshift. My error is:

Missing newline: Unexpected character 0x24 found at location nnn 

I'm using this command which includes the ACCEPTINVCHARS option, and the column in question is defined as VARCHAR(80)

copy <dest_tbl> from <S3 source> 
CREDENTIALS <my_credentials>  IGNOREHEADER 1 ENCODING UTF8 
IGNOREBLANKLINES NULL AS '\\N' 
EMPTYASNULL BLANKSASNULL gzip ACCEPTINVCHARS timeformat 'auto' 
dateformat 'auto' MAXERROR 1 compupdate on;

The errors look like this in vi

An octal dump looks like this:

I'm not understanding why this is failing given the ACCEPTINVCHARS documentation at Amazon Can anyone suggest a solution or a workaround? Put another way, what do I need to do to ensure that Redshift accepts this string in this field?


回答1:


Octal dump shows they are null values (NUL) which are treated as line terminator by redshift copy command.

Use NULL AS '\0' instead default '\N',



来源:https://stackoverflow.com/questions/43297955/why-doesnt-acceptinvchars-work-here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!