1

I am getting below error when executing :

SELECT aws_s3.table_import_from_s3(   'test',  
'a,b,c,d,e',   
'(format csv)',  
'abc-ttt-dev',
   'outer/inner/Inbound/sample.csv',
   'us-east-1'
);

SQL Error [22021]: ERROR: invalid byte sequence for encoding "UTF8": 0x00 Where: COPY test, line 1 SQL statement "copy test (a,b,c,d,e) from '/rdsdbdata/extensions/aws_s3/amazon-s3-fifo-6826-20210708T140854Z-0' with (format csv)"

Just for information, Below query works perfectly fine.

SELECT aws_s3.table_import_from_s3(
   'test',
   'a,b,d,e',
   'DELIMITER ''|''', 
   'abc-ttt-dev',
   'outer/inner/Inbound/sample.txt',
   'us-east-1'
);

Table script is

CREATE TABLE test (
    a text not NULL,
    b text not NULL,
    c text not NULL,
    d text not NULL,
    e text not NULL
);

1 Answer 1

0

I think there are NULL values in your csv file and that is the reason you get this error.

You can either pre process the file using lambda or refer to Postgres error on insert - ERROR: invalid byte sequence for encoding “UTF8”: 0x00 for other workarounds.

Sign up to request clarification or add additional context in comments.

1 Comment

There was some problem with my CSV file. I used another one and it worked well. Thanks for your help @Naman.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.