Skip to content

Conversation

NickCrews
Copy link
Contributor

@NickCrews NickCrews commented Feb 21, 2025

If we create a table with a nested type (such as struct, map, or union), then all the children types, (such as ENUMS) need to have already been created with an eg CREATE TYPE severity AS ENUM [<values>] DDL statement. See the duckdb docs

This fails with

sqlalchemy.exc.ProgrammingError: (duckdb.duckdb.CatalogException) Catalog Error: Type with name severity does not exist!
Did you mean "varint"?
[SQL: 
CREATE TABLE test_struct (
        id INTEGER NOT NULL, 
        struct STRUCT("severity" severity), 
        map MAP(VARCHAR, severity), 
        "union" UNION("age" INTEGER, "severity" severity), 
        PRIMARY KEY (id)
)

]
(Background on this error at: https://sqlalche.me/e/14/f405)

I started trying to figure out what the needed change is, but I got stumped. If you point me in the right direction, I can write the fix.

(For myself: test with uv tool run poetry run pytest -k test_double_nested_type_ddl duckdb_engine/tests/test_datatypes.py )

@NickCrews
Copy link
Contributor Author

Actually, I think the nesting merely surfaces the problem, but I think the underlying cause is that NONE of the custom types are created before the tables are. See #1237

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

Successfully merging this pull request may close these issues.

1 participant