Home > Software design >  Postgres aws_s3 extention not accepting timestamp input
Postgres aws_s3 extention not accepting timestamp input

Time:01-10

I have a csv with a timestamp column like this 2021-05-27 11:57:23 but the table_import_from_s3 function (from the aws_s3 postgres extension) keeps giving me this error:

ERROR:  invalid input syntax for type timestamp: "start_time"

Has anyone successfully imported timestamp fields using this extension?

A manual INSERT statement with the same values works fine.

CodePudding user response:

The issue was the missing HEADER parameter which gets passed to the postgres COPY command in the extension, since my CSV file does contain a header row.

Before

SELECT aws_s3.table_import_from_s3 (
  'my-table',
  '',
  '(format csv)',
  :'s3_uri'
);

After

SELECT aws_s3.table_import_from_s3 (
  'my-table',
  '',
  '(format csv, header)',
  :'s3_uri'
);
  •  Tags:  
  • Related