Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable_extension function missing #209

Closed
rakesh-tmdc opened this issue Sep 24, 2024 · 3 comments · Fixed by #212
Closed

enable_extension function missing #209

rakesh-tmdc opened this issue Sep 24, 2024 · 3 comments · Fixed by #212

Comments

@rakesh-tmdc
Copy link

rakesh-tmdc commented Sep 24, 2024

It is mentioned that to Enable the DuckDB Iceberg extension using SELECT duckdb.enable_extension('iceberg') and read Iceberg files with iceberg_scan. but when i do this i getting error that is -

postgres=# SELECT duckdb.enable_extension('iceberg'); ERROR: function duckdb.enable_extension(unknown) does not exist LINE 1: SELECT duckdb.enable_extension('iceberg'); ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.

This shows that the enable_extension function is not available.

@JelteF
Copy link
Collaborator

JelteF commented Sep 24, 2024

It's a mistake in the readme (I created a PR to fix that). You should use duckdb.install_extension instead.

JelteF added a commit that referenced this issue Sep 24, 2024
The readme was using an outdated/incorrect name for the
`install_extension` function. This corrects that.

Fixes #209
Partially fixes #177
@rakesh-tmdc
Copy link
Author

rakesh-tmdc commented Sep 25, 2024

Hey @JelteF Thanks for the update. I did try that below are the steps -

postgres=# DROP EXTENSION IF EXISTS pg_duckdb; CREATE EXTENSION pg_duckdb; SET duckdb.execution TO true;SHOW duckdb.execution;

NOTICE:  extension "pg_duckdb" does not exist, skipping
DROP EXTENSION
WARNING:  To actually execute queries using DuckDB you need to run "SET duckdb.execution TO true;"
CREATE EXTENSION
SET
 duckdb.execution 
------------------
 on
(1 row)
postgres=# SELECT duckdb.install_extension('iceberg');
install_extension 
-------------------
 t
(1 row)
postgres=# SELECT count(*) FROM iceberg_scan('s3a://****/sanity/iceberg/tablea') as (customerid TEXT);
WARNING:  (PGDuckDB/CreatePlan) Prepared query returned an error: 'Catalog Error: Table Function with name "iceberg_scan" is not in the catalog, but it exists in the iceberg extension.

Please try installing and loading the iceberg extension:
INSTALL iceberg;
LOAD iceberg;


WARNING:  (PGDuckDB/CreatePlan) Prepared query returned an error: 'Catalog Error: Table Function with name "iceberg_scan" is not in the catalog, but it exists in the iceberg extension.

Please try installing and loading the iceberg extension:
INSTALL iceberg;
LOAD iceberg;


ERROR:  Function `iceberg_scan(TEXT)` only works with Duckdb execution.
CONTEXT:  PL/pgSQL function iceberg_scan(text) line 3 at RAISE

this error shows that iceberg_scan function is also not available even when Duckdb execution is ON.

@JelteF
Copy link
Collaborator

JelteF commented Oct 14, 2024

Oh sorry, I somehow missed this response. That's indeed a bug. The workaround is to reconnect after calling duckdb.install_extension(). Then the iceberg_scan function should start working. I created #278 to track fixing that issue.

JelteF added a commit that referenced this issue Oct 14, 2024
Previously the error would be shown as a WARNING and then the query
would be run as a fallback using the Postgres executor, which would fail
because the DuckDB `read_csv`/`read_parquet` functions cannot be
executed by the Postgres executor. This is quite confusing as many
people only look at the last ERROR, and not the warnings before.

This is also relevant for MotherDuck support, since the MotherDuck
backed tables can only be read using the DuckDB executor.

Fixes #106
Related to #209 (the error there looks terribly confusing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants