Skip to content

Fix type mismatch when COLLATE is used with type cast in distributed …#8498

Open
bfa-dev wants to merge 6 commits intocitusdata:mainfrom
bfa-dev:fix/8469-collate-varchar-type-mismatch
Open

Fix type mismatch when COLLATE is used with type cast in distributed …#8498
bfa-dev wants to merge 6 commits intocitusdata:mainfrom
bfa-dev:fix/8469-collate-varchar-type-mismatch

Conversation

@bfa-dev
Copy link
Copy Markdown

@bfa-dev bfa-dev commented Mar 8, 2026

DESCRIPTION: Fixes type mismatch when COLLATE is used with type cast in distributed queries

RelabelTypeToCollateExpr was dropping the type cast (e.g. ::VARCHAR) when converting RelabelType nodes to CollateExpr for deparsing. Workers received expr COLLATE "C" (returning text) instead of (expr COLLATE "C")::varchar, causing "attribute of type record has wrong type" errors.

Fix: when the RelabelType changes both type and collation, preserve the cast by wrapping the CollateExpr in a new RelabelType with DEFAULT_COLLATION_OID to avoid re-detection.

Fixes #8469

Furkan Akgul and others added 6 commits March 8, 2026 20:21
…queries

RelabelTypeToCollateExpr was dropping the type cast (e.g. ::VARCHAR) when
converting RelabelType nodes to CollateExpr for deparsing. When the
RelabelType changes both collation and type, preserve the cast by wrapping
the CollateExpr in a new RelabelType.

Fixes citusdata#8469
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.

sqlancer test fail with COLLATE used in string concatenation

1 participant