public inbox for [email protected]  
help / color / mirror / Atom feed
BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables
3+ messages / 3 participants
[nested] [flat]

* BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables
@ 2026-03-16 15:51 PG Bug reporting form <[email protected]>
  2026-03-17 12:14 ` Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables Fujii Masao <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Bug reporting form @ 2026-03-16 15:51 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

The following bug has been logged on the website:

Bug reference:      19435
Logged by:          Hang ammmkilo
Email address:      [email protected]
PostgreSQL version: 18.3
Operating system:   Ubuntu 22.04
Description:        

A user encountered an error when attempting to execute a query involving
multiple RIGHT JOIN operations and a NATURAL JOIN on the same table
(pg_table_a). The error message returned was:
[XX000]ERROR: no relation entry for relid 2
This error seems to be an internal one and should not be triggered by users.
It might be a bug.
```sql
DROP TABLE IF EXISTS pg_table_a;

CREATE TABLE pg_table_a (
    id INTEGER PRIMARY KEY,
    col_bool BOOLEAN
);

INSERT INTO pg_table_a (id, col_bool)
VALUES (5, TRUE);

SELECT  1 AS c1
FROM (
    pg_table_a AS tom0
    RIGHT JOIN (
        (pg_table_a AS tom1 NATURAL JOIN pg_table_a AS tom2)
        RIGHT JOIN pg_table_a AS tom3
        ON tom1.col_bool IS NOT NULL
    )
    ON tom1.col_bool
);
```








^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables
  2026-03-16 15:51 BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables PG Bug reporting form <[email protected]>
@ 2026-03-17 12:14 ` Fujii Masao <[email protected]>
  2026-03-17 12:33   ` Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables Kirill Reshke <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Fujii Masao @ 2026-03-17 12:14 UTC (permalink / raw)
  To: [email protected]; [email protected]; +Cc: Alexander Korotkov <[email protected]>

On Tue, Mar 17, 2026 at 7:34 PM PG Bug reporting form
<[email protected]> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference:      19435
> Logged by:          Hang ammmkilo
> Email address:      [email protected]
> PostgreSQL version: 18.3
> Operating system:   Ubuntu 22.04
> Description:
>
> A user encountered an error when attempting to execute a query involving
> multiple RIGHT JOIN operations and a NATURAL JOIN on the same table
> (pg_table_a). The error message returned was:
> [XX000]ERROR: no relation entry for relid 2
> This error seems to be an internal one and should not be triggered by users.
> It might be a bug.
> ```sql
> DROP TABLE IF EXISTS pg_table_a;
>
> CREATE TABLE pg_table_a (
>     id INTEGER PRIMARY KEY,
>     col_bool BOOLEAN
> );
>
> INSERT INTO pg_table_a (id, col_bool)
> VALUES (5, TRUE);
>
> SELECT  1 AS c1
> FROM (
>     pg_table_a AS tom0
>     RIGHT JOIN (
>         (pg_table_a AS tom1 NATURAL JOIN pg_table_a AS tom2)
>         RIGHT JOIN pg_table_a AS tom3
>         ON tom1.col_bool IS NOT NULL
>     )
>     ON tom1.col_bool
> );
> ```

Thanks for the report!

I was able to reproduce this issue on the master. git bisect that I ran pointed
to commit fc069a3a631 as the likely cause. So I've CC'd its committer,
Alexander, on this thread.

Regards,

-- 
Fujii Masao






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables
  2026-03-16 15:51 BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables PG Bug reporting form <[email protected]>
  2026-03-17 12:14 ` Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables Fujii Masao <[email protected]>
@ 2026-03-17 12:33   ` Kirill Reshke <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Kirill Reshke @ 2026-03-17 12:33 UTC (permalink / raw)
  To: Fujii Masao <[email protected]>; +Cc: [email protected]; [email protected]; Alexander Korotkov <[email protected]>

On Tue, 17 Mar 2026 at 17:15, Fujii Masao <[email protected]> wrote:
>
> On Tue, Mar 17, 2026 at 7:34 PM PG Bug reporting form
> <[email protected]> wrote:
> >
> > The following bug has been logged on the website:
> >
> > Bug reference:      19435
> > Logged by:          Hang ammmkilo
> > Email address:      [email protected]
> > PostgreSQL version: 18.3
> > Operating system:   Ubuntu 22.04
> > Description:
> >
> > A user encountered an error when attempting to execute a query involving
> > multiple RIGHT JOIN operations and a NATURAL JOIN on the same table
> > (pg_table_a). The error message returned was:
> > [XX000]ERROR: no relation entry for relid 2
> > This error seems to be an internal one and should not be triggered by users.
> > It might be a bug.
> > ```sql
> > DROP TABLE IF EXISTS pg_table_a;
> >
> > CREATE TABLE pg_table_a (
> >     id INTEGER PRIMARY KEY,
> >     col_bool BOOLEAN
> > );
> >
> > INSERT INTO pg_table_a (id, col_bool)
> > VALUES (5, TRUE);
> >
> > SELECT  1 AS c1
> > FROM (
> >     pg_table_a AS tom0
> >     RIGHT JOIN (
> >         (pg_table_a AS tom1 NATURAL JOIN pg_table_a AS tom2)
> >         RIGHT JOIN pg_table_a AS tom3
> >         ON tom1.col_bool IS NOT NULL
> >     )
> >     ON tom1.col_bool
> > );
> > ```
>
> Thanks for the report!
>
> I was able to reproduce this issue on the master. git bisect that I ran pointed
> to commit fc069a3a631 as the likely cause. So I've CC'd its committer,
> Alexander, on this thread.
>
> Regards,
>
> --
> Fujii Masao
>
>

My git bisect shows the same commit
also, after "set enable_self_join_elimination to false;" query executes ok

-- 
Best regards,
Kirill Reshke






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-03-17 12:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-16 15:51 BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables PG Bug reporting form <[email protected]>
2026-03-17 12:14 ` Fujii Masao <[email protected]>
2026-03-17 12:33   ` Kirill Reshke <[email protected]>

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