Skip to content

Commit 377a61e

Browse files
committed
Print char/varchar None length as unbounded
1 parent 1b69c4c commit 377a61e

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

src/expr/src/scalar/func/impls/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ impl fmt::Display for CastStringToChar {
588588
self.fail_on_len
589589
)
590590
}
591-
None => f.write_str("text_to_char[len=None]"),
591+
None => f.write_str("text_to_char[len=unbounded]"),
592592
}
593593
}
594594
}
@@ -726,7 +726,7 @@ impl fmt::Display for CastStringToVarChar {
726726
self.fail_on_len
727727
)
728728
}
729-
None => f.write_str("text_to_varchar[len=None]"),
729+
None => f.write_str("text_to_varchar[len=unbounded]"),
730730
}
731731
}
732732
}

src/sql/src/func.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,7 @@ pub static PG_CATALOG_BUILTINS: LazyLock<BTreeMap<&'static str, Func>> = LazyLoc
18101810
let elem_type = match elem_type.array_of_self_elem_type() {
18111811
Ok(elem_type) => elem_type,
18121812
Err(elem_type) => bail_unsupported!(
1813+
// This will be used in error msgs, therefore we call with `postgres_compat` false.
18131814
format!("array_fill on {}", ecx.humanize_scalar_type(&elem_type, false))
18141815
),
18151816
};

test/sqllogictest/github-5536.slt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ Explained Query:
4444
Filter (#0 <= #0) AND (#0 >= #0)
4545
ReadStorage materialize.public.t5
4646
ArrangeBy keys=[[]]
47-
Filter (#1 = text_to_char[len=None](text_to_varchar[len=None](boolean_to_text(like["0.31161855206970124"](padchar(#1))))))
47+
Filter (#1 = text_to_char[len=unbounded](text_to_varchar[len=unbounded](boolean_to_text(like["0.31161855206970124"](padchar(#1))))))
4848
ReadStorage materialize.public.t3
4949
ArrangeBy keys=[[]]
5050
ReadStorage materialize.public.t5
5151

5252
Source materialize.public.t0
5353
Source materialize.public.t3
54-
filter=((#1 = text_to_char[len=None](text_to_varchar[len=None](boolean_to_text(like["0.31161855206970124"](padchar(#1)))))))
54+
filter=((#1 = text_to_char[len=unbounded](text_to_varchar[len=unbounded](boolean_to_text(like["0.31161855206970124"](padchar(#1)))))))
5555
Source materialize.public.t5
5656

5757
Target cluster: quickstart

test/sqllogictest/tpch_create_materialized_view.slt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1929,7 +1929,7 @@ TopK order_by=[#0 asc nulls_last]
19291929
Filter (select(Get l1) AND (integer_to_numeric(#2) > select(Get l2)))
19301930
Get materialize.public.partsupp
19311931
Return
1932-
Filter ((select(Get l3) AND (#3 = #7)) AND (#8 = text_to_char[len=None]("CANADA")))
1932+
Filter ((select(Get l3) AND (#3 = #7)) AND (#8 = text_to_char[len=unbounded]("CANADA")))
19331933
CrossJoin
19341934
Get materialize.public.supplier
19351935
Get materialize.public.nation

test/sqllogictest/tpch_select.slt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1922,7 +1922,7 @@ Finish order_by=[#0 asc nulls_last] output=[#0, #1]
19221922
Filter (select(Get l1) AND (integer_to_numeric(#2) > select(Get l2)))
19231923
Get materialize.public.partsupp
19241924
Return
1925-
Filter ((select(Get l3) AND (#3 = #7)) AND (#8 = text_to_char[len=None]("CANADA")))
1925+
Filter ((select(Get l3) AND (#3 = #7)) AND (#8 = text_to_char[len=unbounded]("CANADA")))
19261926
CrossJoin
19271927
Get materialize.public.supplier
19281928
Get materialize.public.nation

test/sqllogictest/type-promotion.slt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ query T multiline
304304
EXPLAIN RAW PLAN FOR
305305
SELECT lower('a'::char);
306306
----
307-
Map (lower(char_to_text(text_to_char[len=1, fail_on_len=false](text_to_char[len=None]("a")))))
307+
Map (lower(char_to_text(text_to_char[len=1, fail_on_len=false](text_to_char[len=unbounded]("a")))))
308308
Constant
309309
- ()
310310

@@ -317,7 +317,7 @@ query T multiline
317317
EXPLAIN RAW PLAN FOR
318318
SELECT 'a'::"char" < 'a'::varchar;
319319
----
320-
Map (("char"_to_text(text_to_"char"("a")) < varchar_to_text(text_to_varchar[len=None]("a"))))
320+
Map (("char"_to_text(text_to_"char"("a")) < varchar_to_text(text_to_varchar[len=unbounded]("a"))))
321321
Constant
322322
- ()
323323

@@ -330,7 +330,7 @@ query T multiline
330330
EXPLAIN RAW PLAN FOR
331331
SELECT 'a'::"char" < 'a'::char;
332332
----
333-
Map (("char"_to_text(text_to_"char"("a")) < char_to_text(text_to_char[len=1, fail_on_len=false](text_to_char[len=None]("a")))))
333+
Map (("char"_to_text(text_to_"char"("a")) < char_to_text(text_to_char[len=1, fail_on_len=false](text_to_char[len=unbounded]("a")))))
334334
Constant
335335
- ()
336336

@@ -343,7 +343,7 @@ query T multiline
343343
EXPLAIN RAW PLAN FOR
344344
SELECT 'a'::char < 'a'::varchar;
345345
----
346-
Map ((text_to_char[len=1, fail_on_len=false](text_to_char[len=None]("a")) < text_to_char[len=None](text_to_varchar[len=None]("a"))))
346+
Map ((text_to_char[len=1, fail_on_len=false](text_to_char[len=unbounded]("a")) < text_to_char[len=unbounded](text_to_varchar[len=unbounded]("a"))))
347347
Constant
348348
- ()
349349

@@ -357,7 +357,7 @@ query T multiline
357357
EXPLAIN RAW PLAN FOR
358358
SELECT 'a'::char < 'a'::text;
359359
----
360-
Map ((char_to_text(text_to_char[len=1, fail_on_len=false](text_to_char[len=None]("a"))) < "a"))
360+
Map ((char_to_text(text_to_char[len=1, fail_on_len=false](text_to_char[len=unbounded]("a"))) < "a"))
361361
Constant
362362
- ()
363363

@@ -369,7 +369,7 @@ query T multiline
369369
EXPLAIN RAW PLAN FOR
370370
SELECT 'a'::varchar < 'a'::text;
371371
----
372-
Map ((varchar_to_text(text_to_varchar[len=None]("a")) < "a"))
372+
Map ((varchar_to_text(text_to_varchar[len=unbounded]("a")) < "a"))
373373
Constant
374374
- ()
375375

@@ -382,7 +382,7 @@ query T multiline
382382
EXPLAIN RAW PLAN FOR
383383
SELECT coalesce('a'::char, 'a'::varchar, 'a'::text);
384384
----
385-
Map (coalesce(text_to_char[len=1, fail_on_len=false](text_to_char[len=None]("a")), text_to_char[len=None](text_to_varchar[len=None]("a")), text_to_char[len=None]("a")))
385+
Map (coalesce(text_to_char[len=1, fail_on_len=false](text_to_char[len=unbounded]("a")), text_to_char[len=unbounded](text_to_varchar[len=unbounded]("a")), text_to_char[len=unbounded]("a")))
386386
Constant
387387
- ()
388388

@@ -394,7 +394,7 @@ query T multiline
394394
EXPLAIN RAW PLAN FOR
395395
SELECT coalesce('a'::char, 'a'::text, 'a'::varchar);
396396
----
397-
Map (coalesce(text_to_char[len=1, fail_on_len=false](text_to_char[len=None]("a")), text_to_char[len=None]("a"), text_to_char[len=None](text_to_varchar[len=None]("a"))))
397+
Map (coalesce(text_to_char[len=1, fail_on_len=false](text_to_char[len=unbounded]("a")), text_to_char[len=unbounded]("a"), text_to_char[len=unbounded](text_to_varchar[len=unbounded]("a"))))
398398
Constant
399399
- ()
400400

@@ -1729,7 +1729,7 @@ Explained Query:
17291729
Union // { types: "(varchar?)" }
17301730
ReadStorage materialize.public.t1 // { types: "(varchar(3)?)" }
17311731
Project (#1) // { types: "(varchar?)" }
1732-
Map (text_to_varchar[len=None](#0)) // { types: "(char(2)?, varchar?)" }
1732+
Map (text_to_varchar[len=unbounded](#0)) // { types: "(char(2)?, varchar?)" }
17331733
ReadStorage materialize.public.t3 // { types: "(char(2)?)" }
17341734

17351735
Source materialize.public.t1

0 commit comments

Comments
 (0)