From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, David Rowley <dgrowleyml(at)gmail(dot)com>, Ronald Cruz <cruz(at)rentec(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org, Peter Ford <pford(at)rentec(dot)com>, "Aaron J(dot) Garcia" <agarcia(at)rentec(dot)com> |
Subject: | Re: Query result differences between PostgreSQL 17 vs 16 |
Date: | 2025-03-03 06:40:47 |
Message-ID: | CAMbWs4_4HBfqs+AjrtNOeqZYwKTJps2jANzdCbAfQSCd-CdeGA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sat, Mar 1, 2025 at 12:48 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Richard Guo <guofenglinux(at)gmail(dot)com> writes:
> > Now I'm inclined to agree with you. It seems we've been lucky so far
> > not to encounter issues with IS NULL deductions on clone clauses, but
> > this feels like a problem waiting to happen in the future.
>
> Yes, I'm on board with that too. I think the comments need more work
> than you've done though. I think they should say something about
> "nullingrel bits in clone clauses may not reflect reality, so we dare
> not draw conclusions from clones about whether Vars are guaranteed
> not-null". Also, I'm not convinced any more that this has anything to
> do with missing clone members, so we should remove that claim.
Agreed. Thanks for the suggestion.
> > The no-clone-quals limitation in restriction_is_always_false makes the
> > fix in f00ab1fd1 unnecessary. I think we should revert those changes.
>
> Hmm, I'm less on board with that. The saving-and-restoring of
> last_rinfo_serial looks correct to me, even though this fix might
> cause the test case you found before to not tickle that bug.
Fair point.
> > Attached is the updated patch.
>
> I'm confused by the changes to existing test cases in this? It looks
> like you're undoing some test changes that are not from f00ab1fd1, so
> I don't understand why. My inclination here would be to add a new
> test that exposes the current bug, but leave the rest alone, even
> though they may no longer be testing exactly what they were originally
> meant to do.
Yeah, the patch modifies some existing test cases that are intended to
test a join clause that is IS_NOT_NULL/IS_NULL qual can or cannot be
reduced depending on whether its Var is nullable by any outer joins.
And it happens that the join clauses in these test cases are clone
clauses, which are excluded from reduction by the fix here. As a
result, they are no longer testing what they are intended to. This
patch modifies them to ensure that those join clauses are not clone
clauses.
This patch also adds a new test that exposes the current bug, and
tests that clone clauses are not reduced to constant true/false.
Here is an updated patch, which also includes the test case you found
proving the no-clone-quals limitation in restriction_is_always_false
is also needed.
Thanks
Richard
Attachment | Content-Type | Size |
---|---|---|
v3-0001-Avoid-NullTest-deduction-for-clone-clauses.patch | application/octet-stream | 16.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Guo | 2025-03-03 06:50:38 | Re: Query result differences between PostgreSQL 17 vs 16 |
Previous Message | PG Bug reporting form | 2025-03-02 21:00:30 | BUG #18830: ExecInitMerge Segfault on MERGE |