Skip to content

Commit 0c296a5

Browse files
committed
sem/tree: mark LTREE as ambiguous type for proper casting
LTREE datums need explicit type casts when formatted to avoid being misinterpreted as strings by the query engine. Previously, LTREE[] arrays were formatted as ARRAY['j.k.l'] which loses type information, causing the query engine to interpret them as string[] and resulting in errors like: ``` unsupported comparison operator: <ltree[]> >= <string[]> ``` Marking LTREE as an ambiguous type ensures the formatter includes explicit type casts (e.g., ARRAY['j.k.l']::LTREE[]), preventing type mismatches in distributed queries. Closes: #156121 Epic: CRDB-55075 Release note: none
1 parent e7ec6cd commit 0c296a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/sql/sem/tree/datum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4273,7 +4273,7 @@ func (d *DLTree) Max(ctx context.Context, cmpCtx CompareContext) (Datum, bool) {
42734273
}
42744274

42754275
// AmbiguousFormat implements the Datum interface.
4276-
func (*DLTree) AmbiguousFormat() bool { return false }
4276+
func (*DLTree) AmbiguousFormat() bool { return true }
42774277

42784278
// Format implements the NodeFormatter interface.
42794279
func (d *DLTree) Format(ctx *FmtCtx) {

0 commit comments

Comments
 (0)