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

IMPORT FOREIGN SCHEMA fails with "Ambiguous reference to catalog or schema" #29

Open
wearpants opened this issue Jan 2, 2024 · 0 comments

Comments

@wearpants
Copy link
Contributor

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

sprintf(query, "PRAGMA table_info(%s.%s)", quote_identifier(remote_schema), quote_identifier(table));

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)
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

No branches or pull requests

1 participant