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

information_schema.tables doesn't contain the tables/views from information_schema itself #3861

Closed
2 tasks done
krlmlr opened this issue Jun 15, 2022 · 4 comments
Closed
2 tasks done
Labels

Comments

@krlmlr
Copy link
Collaborator

krlmlr commented Jun 15, 2022

What happens?

Unlike Postgres, the tables and columns views/tables are empty and don't list the schema of information_schema itself.

To Reproduce

$ echo "CREATE TABLE x (a int); SELECT * FROM information_schema.schemata; SELECT DISTINCT table_name FROM information_schema.tables; SELECT DISTINCT table_name FROM information_schema.columns;" | build/debug/duckdb
┌──────────────┬────────────────────┬──────────────┬───────────────────────────────┬──────────────────────────────┬────────────────────────────┬──────────┐
│ catalog_name │    schema_name     │ schema_owner │ default_character_set_catalog │ default_character_set_schema │ default_character_set_name │ sql_path │
├──────────────┼────────────────────┼──────────────┼───────────────────────────────┼──────────────────────────────┼────────────────────────────┼──────────┤
│              │ pg_catalog         │ duckdb       │                               │                              │                            │          │
│              │ information_schema │ duckdb       │                               │                              │                            │          │
│              │ main               │ duckdb       │                               │                              │                            │          │
│              │ temp               │ duckdb       │                               │                              │                            │          │
└──────────────┴────────────────────┴──────────────┴───────────────────────────────┴──────────────────────────────┴────────────────────────────┴──────────┘
┌────────────┐
│ table_name │
├────────────┤
│ x          │
└────────────┘
┌────────────┐
│ table_name │
├────────────┤
│ x          │
└────────────┘

Environment (please complete the following information):

  • OS: macOS
  • DuckDB Version: cdfb9f9
  • DuckDB Client: CLI

Before Submitting

  • Have you tried this on the latest master branch?

  • Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

@krlmlr
Copy link
Collaborator Author

krlmlr commented Jun 15, 2022

With Postgres:

$ echo "SELECT COUNT(*) FROM information_schema.columns WHERE lower(table_schema) = 'information_schema';" | psql
 count
-------
   696
(1 row)

@rpbouman
Copy link
Contributor

rpbouman commented Jan 9, 2023

As a workaround, you can use the duckdb_% table functions.
See:

https://duckdb.org/docs/sql/duckdb_table_functions

@github-actions
Copy link

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the stale label Jul 30, 2023
@github-actions
Copy link

This issue was closed because it has been stale for 30 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants