Re: Incorrect NOT IN results with implicit casts returning NULL after anti-join optimization

From: BHUVAN CHILUKUTI <c(dot)bhuvan(at)iitg(dot)ac(dot)in>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Guofenglinux <guofenglinux(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Incorrect NOT IN results with implicit casts returning NULL after anti-join optimization
Date: 2026-11-01 03:37:55
Message-ID: PN0P287MB09038F194ADCE7592FE50809A76B2@PN0P287MB0903.INDP287.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Shihao,

Thank you for verifying the report and getting back to me. I've reviewed
the suggestion and agree that we can keep the anti-join for built-in cast
functions and use the SubPlan only for user-defined ones.

Regards,
Bhuvan
________________________________
From: shihao zhong <zhong950419(at)gmail(dot)com>
Sent: Sunday, November 1, 2026 8:45 AM
To: BHUVAN CHILUKUTI <c(dot)bhuvan(at)iitg(dot)ac(dot)in>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org <pgsql-bugs(at)lists(dot)postgresql(dot)org>; Guofenglinux <guofenglinux(at)gmail(dot)com>; Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Incorrect NOT IN results with implicit casts returning NULL after anti-join optimization

You don't often get email from zhong950419(at)gmail(dot)com(dot) Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
Hi Bhuvan,

Thanks for reporting it. I can reproduce this on master and on
REL_19_STABLE. It is a v19 regression from 383eb21ebff.

One concern from code. The patch also removes the anti-join fo
built-in casts, which never return NULL.

numeric_col NOT IN (SELECT int_col ...)
text_col NOT IN (SELECT char_col ...)

Could we keep the anti-join for built-in cast functions, and use the
SubPlan only for user-defined ones?

Thanks,
Shihao

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dilip Kumar 2026-11-01 06:23:27 Re: BUG #19817: CREATE UNIQUE INDEX on a partitioned table can silently attach an invalid, not-ready child index, le
Previous Message shihao zhong 2026-11-01 03:15:58 Re: Incorrect NOT IN results with implicit casts returning NULL after anti-join optimization