coerce_type discard unnecessary CollateExprs

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: coerce_type discard unnecessary CollateExprs
Date: 2026-06-29 11:25:40
Message-ID: CACJufxGNafm5FUNKJGpc9LkBDEUCjWHqtEZ=6_L8V8Rh3G9jOg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

In coerce_to_target_type, we have comments like
/*
* Note that if there are multiple stacked CollateExprs, we just
discard all but the topmost.
*/
origexpr = expr;
while (expr && IsA(expr, CollateExpr))
expr = (Node *) ((CollateExpr *) expr)->arg;

Only the topmost CollateExpr will be used, all others will be dropped.
We can apply this to coerce_type also.
See the attached minor patch.

--
jian
https://www.enterprisedb.com/

Attachment Content-Type Size
v1-0001-coerce_type.patch application/x-patch 1001 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2026-06-29 11:50:45 Re: use of SPI by postgresImportForeignStatistics
Previous Message jian he 2026-06-29 11:13:07 Re: statatt_build_stavalues->LOCAL_FCINFO wrong number