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
Casting structs with fields of the same name, but in a different order fails with duckdb.duckdb.TypeMismatchException: Mismatch Type Error.
The documentation about casting structs only mention that field names have to match:
When casting structs, the names of fields have to match
If the requirement is that the fields have to be in the same order, then perhaps it could be made more explicit in the documentation.
To Reproduce
CREATETABLEt1 (s STRUCT(a STRING, b INT));
INSERT INTO t1 SELECT {'b': 42, 'a': 'foo'};
duckdb.duckdb.TypeMismatchException: Mismatch Type Error: Type STRUCT(b INTEGER, a VARCHAR) does not match with STRUCT(a VARCHAR, b INTEGER). Cannot cast STRUCTs with different names