Skip to content

Commit 7d1a619

Browse files
committed
sql: remove wrapping single quotes in output of ltree2text
Fixes #156479 Release note (bug fix): A bug has been fix with the `ltree2text` built-in function in which the returned `TEXT` value was incorrectly wrapped with single quotes. This bug has been present since the `ltree2text` built-in was introduced in v25.4.0.
1 parent 2340f9a commit 7d1a619

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pkg/sql/logictest/testdata/logic_test/ltree

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ SELECT subpath(NULL::LTREE, 99, 99);
263263
----
264264
NULL
265265

266-
# An overflow has occurred
266+
# An overflow has occurred
267267
query error invalid positions
268268
SELECT subpath('A.B.C'::LTREE, 1, 9223372036854775807::INT8)
269269

@@ -344,10 +344,12 @@ foo_bar-baz.baz
344344
query error could not parse ltree
345345
SELECT text2ltree('foo..bar');
346346

347-
query T
348-
SELECT ltree2text('foo_bar-baz.baz'::LTREE);
347+
query TBB
348+
SELECT ltree2text('foo_bar-baz.baz'::LTREE),
349+
ltree2text('foo'::LTREE) = 'foo'::TEXT,
350+
ltree2text(NULL::LTREE) IS NULL;
349351
----
350-
'foo_bar-baz.baz'
352+
foo_bar-baz.baz true true
351353

352354
query T
353355
SELECT lca('A.B.C'::LTREE, 'A.B.C.D'::LTREE, 'A.B.C.E'::LTREE);

pkg/sql/sem/builtins/builtins.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9630,7 +9630,7 @@ WHERE object_id = table_descriptor_id
96309630
Volatility: volatility.Immutable,
96319631
Fn: func(_ context.Context, _ *eval.Context, args tree.Datums) (tree.Datum, error) {
96329632
ltree := tree.MustBeDLTree(args[0])
9633-
return tree.NewDString(ltree.String()), nil
9633+
return tree.NewDString(ltree.LTree.String()), nil
96349634
},
96359635
},
96369636
),

0 commit comments

Comments
 (0)