Skip to content

Infer DuckDB struct_extract field types - #4719

Open
Boulea7 wants to merge 1 commit into
sqlc-dev:mainfrom
Boulea7:fix/duckdb-struct-extract-4714
Open

Boulea7 wants to merge 1 commit into
sqlc-dev:mainfrom
Boulea7:fix/duckdb-struct-extract-4714

Conversation

@Boulea7

@Boulea7 Boulea7 commented Nov 30, 2026

Copy link
Copy Markdown

Fixes #4714.

DuckDB's struct_extract returns the named field's type. sqlc now resolves that type for a literal field name, including after a single-argument unnest of a list of structs. The generated Go fields remain nullable because a non-null struct can contain null fields.

The regression covers lists of structs, nested extraction, DuckDB's ASCII case handling, and a quoted field name. I also ran the generated Go queries against an in-memory DuckDB and checked both values and nulls.

Development was assisted by Codex and the patch was independently reviewed and tested.

Resolve named struct fields from their type expressions, including list elements produced by one-argument unnest. Preserve DuckDB field spelling and keep the inferred result nullable.
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.

duckdb: struct_extract result is not typed as the field's type

1 participant