pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrei Lepikhov <a.lepikhov@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Vik Fearing <vik@postgresfriends.org>
Cc: zuming.jiang@inf.ethz.ch, pgsql-bugs@lists.postgresql.org, Alexander Korotkov <akorotkov@postgresql.org>
Subject: Re: BUG #18170: Unexpected error: no relation entry for relid 3
Date: Fri, 27 Oct 2023 13:31:36 +0700
Message-ID: <011bcae5-7840-42c7-a50c-b406189e2e78@postgrespro.ru> (raw)
In-Reply-To: <1189851.1698340331@sss.pgh.pa.us>
References: <18170-f1d17bf9a0d58b24@postgresql.org>
	<4ecab120-6be3-4cf6-a2a0-249c73ae91d4@postgresfriends.org>
	<1189851.1698340331@sss.pgh.pa.us>

On 27/10/2023 00:12, Tom Lane wrote:
> Vik Fearing <vik@postgresfriends.org> writes:
>> On 10/26/23 16:01, PG Bug reporting form wrote:
>>> My fuzzer finds a bug in Postgres, which triggers an unexpected error.
> 
>> This bisects to d3d55ce571369dad6e1d582f1655e5a3fbd8594a, Remove useless
>> self-joins.
> 
> I wonder if that new code thinks it can remove ref_2 from the query,
> even though ref_2 is used in the targetlist.  I'm not seeing
> control reach remove_leftjoinrel_from_query, though.

As I see, this join can be removed: in the explain you can see that 
OUTER JOIN is replaced with the INNER JOIN(ref_2, ref_3) ON a key column.
In my opinion, the origin of the problem is that the parent_root 
contains a link to ref_2 in its 
simple_rte_array[]->subquery->targetList. I am still looking for a 
general solution right now, but it doesn't look too complicated at first 
sight.

> Also, while nosing around in this, I tried to pprint(root) at the
> point of the error, and got

Yeah, it is my blunder. Alexander already fixed that, as I see. The only 
question is whether it is worth making the UniqueRelInfo structure as a 
node (for debug purposes - I see only one reason) or we should exclude 
this field from read/write operations at all.

-- 
regards,
Andrei Lepikhov
Postgres Professional






view thread (34+ messages)  latest in thread

Message-ID: <011bcae5-7840-42c7-a50c-b406189e2e78@postgrespro.ru>
Permalink:  ../011bcae5-7840-42c7-a50c-b406189e2e78@postgrespro.ru/
Also on:    postgresql.org/message-id/011bcae5-7840-42c7-a50c-b406189e2e78@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, tgl@sss.pgh.pa.us, vik@postgresfriends.org, akorotkov@postgresql.org
  Subject: Re: BUG #18170: Unexpected error: no relation entry for relid 3
  In-Reply-To: <011bcae5-7840-42c7-a50c-b406189e2e78@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