| From: | Aman Ganapathy <aman(at)stack-auth(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| 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 22:26:21 |
| Message-ID: | CA+jUSqTr=X8Nw8O0hs-7Ew=esr_Puf+RxKWLHvJ53=SE6pth9Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi,
Thank you for looking into this! I encountered this while comparing
behavior between 18 and 19: it isn't inspired by a problem I encountered in
prod. The only angle I see is if you add a NOT NULL constraint it will
cause a saved query of this shape to start failing, but I agree it is
unlikely that someone would use a query of this shape.
Thank you for the explanation and the workaround!
Thanks
Aman
On Wed, Dec 2, 2026 at 8:09 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> 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
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Bossart | 2026-12-02 22:36:49 | Re: JSON_SERIALIZE for JSONB returns parts of the internal JSONB representation |
| Previous Message | Nathan Bossart | 2026-12-02 22:01:17 | Re: JSON_SERIALIZE for JSONB returns parts of the internal JSONB representation |