Catalog Error: The table does not exist in this database
DuckDB cannot find the named table, view or table function in the catalog of the database you are connected to.
- Exception
Catalog Error- Categoría
- Catalog Error
Qué significa
This is DuckDB's missing-object error. The binder looked up the name in the catalog and found nothing with it: no table, no view, no table function. For a missing table the message spells out Table with name X does not exist!. A missing table function reports Table Function with name X does not exist!.
Because DuckDB is often embedded, the usual cause is not a typo but the wrong database: the application opened a fresh in-memory database, the file path resolved relative to a different working directory, or the query ran on a connection that never created the schema. Lookups are case-insensitive even for names created in double quotes, so a table created as "V07Mixed" is found by SELECT * FROM v07mixed and SELECT * FROM "v07mixed".
Causas comunes
- A misspelled table name. Casing does not matter, even for names created with double quotes.
- The query ran against a different database than you think, often a new in-memory one opened by default.
- A table function from an extension that is not loaded, such as
iceberg_scanwith autoloading disabled, does not bind. Built-in functions such asread_csv_autoneed no extension and fail with an IO error on a missing file, not a catalog error. - The migration that creates the table never ran on this connection.
Find the cause
-- What tables does this connection see, and from which file? SELECT database_name, schema_name, table_name, estimated_size FROM duckdb_tables(); SELECT database_name, path FROM duckdb_databases(); -- Search every catalog position of the name, including views and table functions: SELECT * FROM duckdb_tables() WHERE table_name ILIKE '%users%'; SELECT function_name FROM duckdb_functions() WHERE function_name ILIKE '%users%';
Cómo solucionarlo
-
List what actually exists in the connected database before rewriting the query:
SELECT table_schema, table_name, table_type FROM information_schema.tables ORDER BY 1, 2;
-
Check which database file the connection opened. An empty catalog usually means the process opened a new or in-memory database:
SELECT current_database(), database_name, path FROM duckdb_databases();
-
Qualify the name if the table lives in another attached database:
SELECT * FROM backup.users LIMIT 5;
-
Create the table if it should exist, with IF NOT EXISTS so reruns are safe:
CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, email VARCHAR);
Other ways to handle it
If the table should exist, run the migration on this connection instead of working around it. If it should not, point the connection at the right file with an absolute path; relative paths are resolved against the process working directory, which is rarely what you expect in a service.
Reprodúcelo de forma segura
SELECT * FROM no_such_table; -- Catalog Error: Table with name no_such_table does not exist!
Preguntas
The table exists in my file. Why does DuckDB say it does not?
The connection is probably not on that file. Embedded apps often open an unnamed in-memory database by default, and a relative path may have resolved elsewhere. Run SELECT * FROM duckdb_databases() to see the path of what you are connected to.
Does capitalization matter?
Names are matched case-insensitively, including names created inside double quotes. A name created as "V07Mixed" is found by any casing, quoted or not.
Errores relacionados
Catalog ErrorThe table or object already existsBinder ErrorThe column is not in the FROM clauseIO ErrorA file could not be openedSQLITE_ERRORSQLite: SQL logic error42P01PostgreSQL: la relación no existe1146MySQL: la tabla no existe
More catalog error errors
El código y el texto del mensaje son de DuckDB documentation. Explora la lista completa de DuckDB error list o buscar cada error de base de datos.
Work on DuckDB in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for DuckDB and the other databases you use.
Texto y datos de esta página: CC BY 4.0, con atribución a SQLly (sqlly.app). Código y fragmentos SQL: MIT. Detalles de la licencia El texto citado de los mensajes de error pertenece a su proveedor de base de datos.