Search code examples
postgresqlamazon-web-servicescsvamazon-s3amazon-rds

Importing CSV file with semicolon delimiters from S3 to RDS Postgres database


I am trying to import a CSV file that uses semicolons ; as delimiters instead of commas from S3 to AWS RDS Postgres table.

SELECT aws_s3.table_import_from_s3 ('tmp_foo','','(format csv, delimiter '','', header)', 'my-bucket', 'path/file.csv','eu-west-1');

This fails with error

ERROR: Semicolon is not allowed in options

Same thing using delimiter '','' works fine.

How to escape semicolon so that it works? For example delimiter ''\;'' doesn't work.

Importing from S3 is AWS extension available in recent RDS Postgres versions: https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Procedural.Importing.html

I am using Postgres Aurora 11.6.


Solution

  • I asked about this from the AWS Support and they confirmed that semicolon is not supported as a delimiter. Changing this probably won't happen anytime soon.