Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

test: add example failing test for recursive datatype DDLs #1220

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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 )

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant