pg_duckdb
pg_duckdb copied to clipboard
Misleading error when using `read_xxx` functions with invalid URLs
I get ERROR: Function `read_csv(TEXT)` only works with Duckdb execution. when using read_csv (along with the actual error as a warning):
y=# SELECT * from read_csv('https://www.data.gouv.fr/fr/datasets/r/6d186965-f41b-41f3-9b23-88241cc6890c') as (n int);
WARNING: (DuckDB) HTTP Error: Unable to connect to URL "https://www.data.gouv.fr/fr/datasets/r/6d186965-f41b-41f3-9b23-88241cc6890c": 404 (Not Found)
ERROR: Function `read_csv(TEXT)` only works with Duckdb execution.
CONTEXT: PL/pgSQL function read_csv(text) line 3 at RAISE
I would expect the WARNING to be the ERROR and the ERROR to not show.
Once we merge #123 we can use/cache the NeedsDuckdbExecution function and fail with an ERROR instead of WARNING when execution in DuckDB fails. i.e. for queries where NeedsDuckdbExecution returns true there's no point in retrying the query in postgres.