Skip to content

fix: don't annotate non-native type values with ::TYPE inside STRUCT while Inlining#1157

Open
neel-leendev wants to merge 2 commits into
duckdb:v1.5-variegatafrom
leeninc:fix/struct-non-native-type-inlining
Open

fix: don't annotate non-native type values with ::TYPE inside STRUCT while Inlining#1157
neel-leendev wants to merge 2 commits into
duckdb:v1.5-variegatafrom
leeninc:fix/struct-non-native-type-inlining

Conversation

@neel-leendev
Copy link
Copy Markdown

@neel-leendev neel-leendev commented May 13, 2026

When a STRUCT column is inlined on Postgres/SQLite, field values of non-natively supported types (TIMESTAMPTZ, DATE, etc.) were serialized as CAST('value' AS VARCHAR). This annotation survives verbatim in the stored struct string and breaks the struct-from-string parser on read-back, causing an internal crash in TransformInlinedData.

Fix: emit a plain quoted string when !use_native_type since the storage column is already VARCHAR — the annotation is redundant and harmful in this context.

Related to #1155

…inlining

When a STRUCT column is inlined on Postgres/SQLite, field values of non-natively
supported types (TIMESTAMPTZ, DATE, etc.) were serialized as CAST('value' AS VARCHAR).
This annotation survives verbatim in the stored struct string and breaks the
struct-from-string parser on read-back, causing an internal crash in
TransformInlinedData.

Fix: emit a plain quoted string when !use_native_type since the storage column
is already VARCHAR — the annotation is redundant and harmful in this context.
Copy link
Copy Markdown
Member

@pdet pdet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @neel-leendev, thanks for the PR, is looking good, just had a few comments!

@@ -0,0 +1,39 @@
# name: test/sql/data_inlining/data_inlining_struct_non_native_types.test
# description: STRUCT columns with non-natively-supported field types (e.g. TIMESTAMPTZ on Postgres)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we parameterize the test to the other affected types?

i.e.,

	case LogicalTypeId::UUID:
	case LogicalTypeId::DATE:
	case LogicalTypeId::TIME:
	case LogicalTypeId::TIME_NS:
	case LogicalTypeId::TIMESTAMP:
	case LogicalTypeId::TIME_TZ:
	case LogicalTypeId::TIMESTAMP_TZ:
	case LogicalTypeId::TIMESTAMP_SEC:
	case LogicalTypeId::TIMESTAMP_MS:
	case LogicalTypeId::TIMESTAMP_NS:
	case LogicalTypeId::BLOB:
	case LogicalTypeId::GEOMETRY:

case LogicalTypeId::INTERVAL: {
auto interval = IntervalValue::Get(value);
if (!use_native_type) {
return EscapeVarcharForSQL(value.ToString());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the format of value.ToString() the same as '%d months %d days %lld microseconds'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants