Re: wrong query result due to wang plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: tender wang <tndrwang(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: wrong query result due to wang plan
Date: 2023-02-19 19:01:13
Message-ID: 3313769.1676833273@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> So that leads to a conclusion that we could just forget the whole
> thing and always use the syntactic qualscope here. I tried that
> and it doesn't break any existing regression tests, which admittedly
> doesn't prove a lot in this area :-(.

Hmm, I thought it worked, but when I tried it again just now I see a
failure (well, a less efficient plan) for one of the recently added
test cases. I also tried the idea of stripping off lower outer joins,
but that doesn't work in distribute_qual_to_rels, because we haven't
yet formed the SpecialJoinInfos for all the outer joins that are below
the top of the join domain.

So for now I agree with your solution in distribute_qual_to_rels.
It's about equivalent to what we did in older branches, and it's not
real clear that cases with pseudoconstant quals in lower join domains
are common enough to be worth sweating over.

We still have to fix process_implied_equality though, and in that
context we do have all the SpecialJoinInfos, so the strip-the-outer-joins
fix seems to work. See attached.

regards, tom lane

Attachment Content-Type Size
fix-pseudoconstant-qual-placement-some-more.patch text/x-diff 8.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2023-02-19 19:43:45 Re: Add LZ4 compression in pg_dump
Previous Message Tomas Vondra 2023-02-19 17:10:13 Re: Add LZ4 compression in pg_dump