get_rule_expr RelabelType node does not print COLLATE clause
hi.
I found in some cases, we need to print COLLATE clauses for RelabelType Node.
CREATE TABLE ttsa (c1 text[]);
CREATE COLLATION case_sensitive (provider = icu, locale = '');
explain (verbose, cost off) SELECT count(*) FROM ttsa WHERE c1 =
(array[1,2]::int[]::text[]) collate case_sensitive;
QUERY PLAN
--------------------------------------------------------------------
Aggregate
Output: count(*)
-> Seq Scan on public.ttsa
Output: c1
Filter: (ttsa.c1 = '{1,2}'::text[] COLLATE case_sensitive)
(5 rows)
PREPARE p1(int[]) AS SELECT count(*) FROM ttsa WHERE c1 = ($1::text[])
collate case_sensitive;
SET plan_cache_mode = force_generic_plan;
EXPLAIN (VERBOSE, COSTS OFF) EXECUTE p1(array[1,2]);
QUERY PLAN
----------------------------------------------------
Aggregate
Output: count(*)
-> Seq Scan on public.ttsa
Output: c1
Filter: (ttsa.c1 = (($1)::text[])::text[])
(5 rows)
should I expect the above Query plan Filter section also print out the
COLLATE clause explicitly?
like:
Filter: (ttsa.c1 = (($1)::text[])::text[] COLLATE case_sensitive)
jian he <jian.universality@gmail.com> writes:
I found in some cases, we need to print COLLATE clauses for RelabelType Node.
I have a hard time getting excited about that. RelabelType
can only appear in plan trees, not in stored query trees,
so we do not have a requirement for 100% accuracy for dump/reload
purposes. I'm afraid that adding COLLATE would add more chatter
than value to EXPLAIN output.
regards, tom lane