You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
duckdb: columns produced by unnest(..., recursive := true) do not resolve #4713
main at commit 3ad8b20 (2026-10-23). sqlc version prints v1.31.1.
What happened?
In DuckDB, unnest(items, recursive := true) on a list of structs expands into one column per struct field (type, amount). sqlc treats it as a single column:
In a top-level select, the result is one column named Unnest, typed any.
In a CTE, selecting the expanded fields by name fails with unknown column "type".
Expected: one column per struct field, each with the field's name and type.
Workaround: unnest without recursive, then read each field with CAST(struct_extract(it, 'type') AS VARCHAR) (see #4714 and #4655).
Relevant log output
# query 1 generates:type ListItemsRow struct {
ID string
Unnest any
}
# query 2:# package db
query.sql:1:1: unknown column "type"
Database schema
CREATETABLEtransactions (id VARCHARNOT NULL, items STRUCT(type VARCHAR, amount INTEGER)[]);
SQL queries
-- query 1-- name: ListItems :manySELECT id, unnest(items, recursive := true) FROM transactions;
-- query 2-- name: ListItems :many
WITH i AS (SELECT id, unnest(items, recursive := true) FROM transactions)
SELECT id, type, amount FROM i;
Activity