get_rule_expr RelabelType node does not print COLLATE clause

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: get_rule_expr RelabelType node does not print COLLATE clause
Date: 2025-07-19 13:45:37
Message-ID: CACJufxFtc9m6EZUr=4gpzoRGpVawqiHdYPB9YhZ5UGcRT98cfQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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)

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael J. Baars 2025-07-19 14:04:16 Re: Upgrade from Fedora 40 to Fedora 42, or from PostgreSQL 16.3 to PostgreSQL 16.9
Previous Message Thomas Munro 2025-07-19 13:07:16 Re: index prefetching