postgres-aws-s3 icon indicating copy to clipboard operation
postgres-aws-s3 copied to clipboard

system-defined vs user-defined metadata for Content-Encoding on S3 object misses gzip

Open jleto opened this issue 2 years ago • 0 comments

Screen Shot 2021-07-12 at 10 33 00 AM

Some tools like pyspark dataframe s3 write does not set AWS system-defined metadata when writing and specifying "gzip" compression. Postgres s3_import extension fails to identify gzip file as gzip compressed. This results in a UTF-8 encoding error (reported byte sequence is the start of a gzip byte sequence). The real error is that postgres did not recognize it as gzip encoding and attempted to process it like an uncompresed text file.

If you attempt to add "Content-Encoding" = "gzip" metadata programmatically, this is added as user-defined metadata. When viewing this metadata via the AWS console after adding this metadata is appears with the key name of "x-amz-meta-content-encoding" and this is not tested for in the extension code.

I will submit a pull request.

jleto avatar Jul 17 '21 20:07 jleto