Re: BUG #19966: FULL JOIN testing a NOT NULL column with IS NULL fails in 19, works in 18

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: aman(at)stack-auth(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19966: FULL JOIN testing a NOT NULL column with IS NULL fails in 19, works in 18
Date: 2026-12-02 16:09:34
Message-ID: 1914271.1796227774@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> A FULL JOIN that runs on 18.7 fails on 19.0 with "FULL JOIN is only
> supported with merge-joinable or hash-joinable join conditions" when its
> join condition uses IS NULL on a NOT NULL column. After dropping the NOT
> NULL constraint, the same query runs on 19.0 too.

> SELECT * FROM a FULL JOIN b ON (a.id IS NULL) = (b.id IS NULL);

Is this intended to depict a real use case? If so what is it?

The reason 19 is erroring out is that it reduces the provably-false
IS NULL test to constant false, after which it hasn't got a "var =
var" clause to perform the full join with. I might get excited
about that if there were any real-world usefulness to a situation
like this one, but I really doubt that there is.

If you had to you could make an end run around it with, say,

SELECT * FROM a FULL JOIN b ON ((a.id+0) IS NULL) = (b.id IS NULL);

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Fujii Masao 2026-12-02 16:52:57 Re: BUG #19967: ecpg crashes after "cursor does not exist" on FETCH or MOVE
Previous Message Pavan 2026-12-02 15:49:33 Re: BUG #19953: pg_stat_io exposes impossible rows for io worker backends