I followed closely the documentation regarding exporting AWS RDS Postgres tables to S3 as CSV and still could not make it work. Documentation URL
More specifically, after creating the aws_s3 extension
CREATE EXTENSION IF NOT EXISTS aws_s3 CASCADE;
I tried to execute this function:
SELECT * from aws_s3.query_export_to_s3('select * from users limit 10', 'sample-s3-bucket', '/users_demo.csv');
which failed with the following error:
[42883] ERROR: function aws_s3.query_export_to_s3(unknown, unknown, unknown) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts.
This error is not documented (or I could not find relevant documentation). It seems the aws_s3.query_export_to_s3 function is actually missing from the extension!
I tried to see if this function aws_s3.query_export_to_s3 is actually missing. I have already tried:
- Listing the available extensions shows
aws_s3esxtension as installed:
SELECT * FROM pg_available_extensions where name like '%aw%';
Result:
name | default_version | installed_version | comment
-------------+-----------------+-------------------+---------------------------------------------
aws_s3 | 1.0 | 1.0 | AWS S3 extension for importing data from S3
aws_commons | 1.0 | 1.0 | Common data types across AWS services
(2 rows)
- Listing the extension functions does not show the
query_export_to_s3function:
SELECT e.extname, ne.nspname AS extschema, p.proname, np.nspname AS proschema
FROM pg_catalog.pg_extension AS e
INNER JOIN pg_catalog.pg_depend AS d ON (d.refobjid = e.oid)
INNER JOIN pg_catalog.pg_proc AS p ON (p.oid = d.objid)
INNER JOIN pg_catalog.pg_namespace AS ne ON (ne.oid = e.extnamespace)
INNER JOIN pg_catalog.pg_namespace AS np ON (np.oid = p.pronamespace)
WHERE d.deptype = 'e' AND e.extname like '%aws%'
ORDER BY 1, 3;
Result:
extname | extschema | proname | proschema
-------------+-----------+------------------------+-------------
aws_commons | public | create_aws_credentials | aws_commons
aws_commons | public | create_s3_uri | aws_commons
aws_s3 | public | table_import_from_s3 | aws_s3
aws_s3 | public | table_import_from_s3 | aws_s3
(4 rows)
- Finally, Dropping and recreating the extension aws_s3 did not work.
More info: PostgreSQL 12.3 on x86_64-pc-linux-gnu.
Can anyone please confirm that this function is actually missing? In other words, can anyone use this function?