Re: Two bugs in reconsider_full_join_clause(), handling coalesce() = const clauses

From: Tomas Vondra <tomas(at)vondra(dot)me>
To: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Two bugs in reconsider_full_join_clause(), handling coalesce() = const clauses
Date: 2026-11-11 19:46:42
Message-ID: 90785563-9746-4289-b5d8-c8a5b8c70953@vondra.me
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 11/11/26 20:11, Tomas Vondra wrote:
>
>
> On 11/11/26 19:49, Kirill Reshke wrote:
>> ...
>>
>> Hi!
>> Cool findings.
>>
>> There is another issue I found during review, but this issue is not
>> directly related (exist on master before and after
>> e50d958f092bc33fcb51089c68c72779bae2a6a3), and maybe should be fixed
>> as separate bugs.But I decided to report here
>>
>> example setup & query
>>
>> CREATE TABLE fj_left (x int);
>> CREATE TABLE fj_right (x int);
>> INSERT INTO fj_left VALUES (0);
>> INSERT INTO fj_right VALUES (1);
>>
>> SELECT a.x AS ax, b.x AS bx
>> FROM fj_left a FULL JOIN fj_right b ON concat(a.x) = b.x::text
>> WHERE coalesce(concat(a.x), b.x::text) = '';
>>
>> (zero rows)
>>
>
> Isn't this the same issue as
> https://www.postgresql.org/message-id/0074fbf7-a92c-417a-937a-6b1fc27aed82@vondra.me
> ?
>
> The fix I posted in that thread is a bit more elaborate, but also uses
> contain_nonstrict_functions. Please take a look and check if my fix
> addresses this issue, and whether it's correct.
>

FWIW with my patch applied your example query returns

ax | bx
----+----
| 1
(1 row)

which I think is the correct / expected result. So I guess it really is
the same issue.

regards

--
Tomas Vondra

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Xnerv Wang 2026-11-11 19:58:12 Re: [PATCH] pg_input_is_valid() reuses the first type name inside a PL/pgSQL loop
Previous Message Greg Burd 2026-11-11 19:29:39 Re: [PATCH] pageinspect: validate line pointers before using them