For example, I have a file called main.db with a schema called main
postgres=# IMPORT FOREIGN SCHEMA main from server duckdb_server into public; ERROR: SQL error during prepare: Binder Error: Ambiguous reference to catalog or schema "main" - use a fully qualified path like "temp.main" PRAGMA table_info(main.fhv_bases)
information_schema looks like:
table_catalog | table_schema | table_name | table_type | self_referencing_column_name | reference_generation | user_defined_type_catalog | user_defined_type_schema | user_defined_type_name | is_insertable_into | is_typed | commit_action
---------------+--------------+----------------------+------------+------------------------------+----------------------+---------------------------+--------------------------+------------------------+--------------------+----------+---------------
main | main | fhv_bases | BASE TABLE | | | | | | YES | NO |
main | main | central_park_weather | BASE TABLE | | | | | | YES | NO |
main | main | yellow_tripdata | BASE TABLE | | | | | | YES | NO |
main | main | green_tripdata | BASE TABLE | | | | | | YES | NO |
main | main | fhvhv_tripdata | BASE TABLE | | | | | | YES | NO |
main | main | fhv_tripdata | BASE TABLE | | | | | | YES | NO |
main | main | bike_data | BASE TABLE | | | | | | YES | NO |
main | myschema | mytables_duckdb | VIEW | | | | | | NO | NO |
(8 rows)
When a duckdb database has both a catalog and a schema with the same name, the
IMPORT FOREIGN SCHEMA
command fails. Seems to be originating here https://github.com/alitrack/duckdb_fdw/blob/90578bc59019048d6183b2014cb100dc827966fc/duckdb_fdw.c#L3055For example, I have a file called
main.db
with a schema calledmain
postgres=# IMPORT FOREIGN SCHEMA main from server duckdb_server into public; ERROR: SQL error during prepare: Binder Error: Ambiguous reference to catalog or schema "main" - use a fully qualified path like "temp.main" PRAGMA table_info(main.fhv_bases)
information_schema looks like: