COALESCE with single argument looks like identity function

From: Maksim Milyutin <maksim(dot)milyutin(at)tantorlabs(dot)ru>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: COALESCE with single argument looks like identity function
Date: 2025-04-11 13:26:36
Message-ID: 8e8573c3-1411-448d-877e-53258b7b2be0@tantorlabs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello everyone!

I've noticed that COALESCE function doesn't converge to argument
expression if it is alone in argument list of COALESCE as part
simplification routine for expressions in planner. This might suppress
further useful transformations when non-strict ops are required from
some expression like converging OUTER JOIN to INNER one with WHERE qual
containing COALESCE over single column from inner side.

The patch of transformation in question for COALESCE is attached.

--
Best regard,
Maksim Milyutin

Attachment Content-Type Size
v1-0001-Simplify-COALESCE-with-single-argument.patch text/x-patch 899 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message YeXiu 2025-04-11 13:29:15 Re: Feature Recommendations for Logical Subscriptions
Previous Message torikoshia 2025-04-11 13:18:06 Re: RFC: Allow EXPLAIN to Output Page Fault Information