Conversation
src/pgduckdb_types.cpp
Outdated
| } | ||
|
|
||
| inline Datum | ||
| ConvertDuckRowDatum(const duckdb::Value &value) { |
There was a problem hiding this comment.
We should really have a separate duckdb.struct type and not reuse the duckdb.row type (but you can copy and slightly modify the implementation of duckdb.row to create this new duckdb.struct type). We need this for one important reason (and possibly a few other less important ones): When duckdb.row is part of a select list, we replace it with a * before sending it to duckdb. We don't want that for this struct type. Apart from that they can basically behave the same, but we need two separate types to make the distinction between a type that is really a multiple columns under the hood (and which thus needs * expansion) versus a type that actually is a single column with a composite type in it.
There was a problem hiding this comment.
@JelteF do we also need to give the ability to create this type from postgres? like -
CREATE TABLE tester(a duckdb.struct);
INSERT INTO TABLE tester(a) VALUES('{a:12, b:12, c:Akshat}');There was a problem hiding this comment.
Also correct me if I am wrong but we are handling the star exapnsion in pgduckdb_ddl::DuckdbHandleDDL, right?
As far as I understood, pgduckdb_target_list_contains_unresolved_type_or_row function helps us in this decision, right?
src/pgduckdb_ruleutils.cpp
Outdated
| } | ||
|
|
||
| bool | ||
| pgduckdb_var_is_duckdb_struct(Var *var) { |
There was a problem hiding this comment.
Question: Where is this utility be used?
There was a problem hiding this comment.
thanks for pointing that out! we won't need that for duckdb.struct. I'll get rid of pgduckdb_var_is_duckdb_struct and pgduckdb_is_duckdb_struct functions
|
Thanks for working on this. I made some relatively small improvements. The major one is to return the |
Thanks! |


This introduces a
duckdb.structtype to postgres which can be used to read theSTRUCTtype in DuckDB.Fixes #599