pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrei Lepikhov <a.lepikhov@postgrespro.ru>
To: Alexander Korotkov <aekorotkov@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Richard Guo <guofenglinux@gmail.com>
Cc: zuming.jiang@inf.ethz.ch
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18261: Inconsistent results of SELECT affected by joined subqueries
Date: Fri, 5 Jan 2024 10:32:26 +0700
Message-ID: <ee0d17cc-240a-44bf-acad-58790efb0153@postgrespro.ru> (raw)
In-Reply-To: <CAPpHfdtwTjDmg0J3g17drXdt6ROxW5HLueSMgpfy+MMHxBHFmw@mail.gmail.com>
References: <18261-2a75d748c928609b@postgresql.org>
	<CAMbWs48_EAPrc_C5qvK2WGvydHvht1JUnXwer9FVeU7t_zA+MQ@mail.gmail.com>
	<2887250.1703781175@sss.pgh.pa.us>
	<CAPpHfdtwTjDmg0J3g17drXdt6ROxW5HLueSMgpfy+MMHxBHFmw@mail.gmail.com>

On 2/1/2024 15:02, Alexander Korotkov wrote:
> On Thu, Dec 28, 2023 at 6:32 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I'd say that that will break the cases rinfo_serial was introduced for.
>> Now, I certainly don't love rinfo_serial and would be happier if we
>> could do without it, but getting rid of it is another research project.
> 
> It's a pity that no regression tests detect that.  The attached patch
> implements the special comparison function, which ignores the
> 'rinfo_serial' field.  This avoids marking 'rinfo_serial' as
> pg_node_attr(equal_ignore).
I've reviewed this patch, and it seems okay. It was a real blunder in 
our understanding of clauses; thanks to all for pointing this out and 
fixing it.
The regression test shows where two fully equal join clauses, applied on 
different join levels, differ by the only required_relids. It covers the 
problem and can be helpful by itself. IMO, one line in this test is 
redundant (see attachment).
The comment on the patch looks okay. But assuming required_relids and 
clause fields of two RestrinctInfos are equal, I can't imagine a 
situation to have different is_pushed_down and incompatible_relids. Is 
it really possible?

-- 
regards,
Andrei Lepikhov
Postgres Professional

Attachments:

tests_arrangement.diff (text/plain, 966B) download diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index faad882a03..063396ab52 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -6881,7 +6881,6 @@ WHERE t1.id = emp1.id RETURNING emp1.id, emp1.code; (3 rows) -- Check that SJE does not mistakenly omit qual clauses (bug #18187) -insert into emp1 values (1, 1); explain (costs off) select 1 from emp1 full join (select * from emp1 t1 join diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql index 4f3c51b6eb..5c420a7c6d 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -2623,7 +2623,6 @@ UPDATE emp1 SET code = t1.code + 1 FROM t1 WHERE t1.id = emp1.id RETURNING emp1.id, emp1.code; -- Check that SJE does not mistakenly omit qual clauses (bug #18187) -insert into emp1 values (1, 1); explain (costs off) select 1 from emp1 full join (select * from emp1 t1 join

view thread (14+ messages)  latest in thread

Message-ID: <ee0d17cc-240a-44bf-acad-58790efb0153@postgrespro.ru>
Permalink:  ../ee0d17cc-240a-44bf-acad-58790efb0153@postgrespro.ru/
Also on:    postgresql.org/message-id/ee0d17cc-240a-44bf-acad-58790efb0153@postgrespro.ru

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: a.lepikhov@postgrespro.ru, aekorotkov@gmail.com, tgl@sss.pgh.pa.us, guofenglinux@gmail.com, zuming.jiang@inf.ethz.ch, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18261: Inconsistent results of SELECT affected by joined subqueries
  In-Reply-To: <ee0d17cc-240a-44bf-acad-58790efb0153@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox