pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: zuming.jiang@inf.ethz.ch
Subject: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN
Date: Tue, 07 Nov 2023 17:04:23 +0000
Message-ID: <18187-831da249cbd2ff8e@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18187
Logged by:          Zuming Jiang
Email address:      zuming.jiang@inf.ethz.ch
PostgreSQL version: 16.0
Operating system:   Ubuntu 20.04
Description:        

My fuzzer finds a bug in Postgres 17devel, which triggers an unexpected
error.

--- Set up database ---
create table t2 (vkey int4, c9 text, primary key(vkey));
create view t4 as select 1 as c_2, 1 as c_3;
create view t5 as 
select  
    1 as c_0, 
    case when '1' ~<=~ ref_0.c9 then 1 else 1 end as c_3 
  from 
    ((t2 as ref_0
        inner join t2 as ref_1
        on (ref_0.vkey = ref_1.vkey))
      right outer join t2 as ref_2
      on (ref_1.vkey = ref_2.vkey ));
------------------------

The fuzzer generates a test case:

--- Test case ---
select  
  ref_5.c_3
from 
  (((select ref_1.c_3 as c_0 from t4 as ref_1) as subq_0
      right outer join t5 as ref_5
      on (subq_0.c_0 = ref_5.c_0))
    right outer join t4 as ref_6
    on (subq_0.c_0 = ref_6.c_2));
------------------------

--- Expected behavior ---
The test case should not trigger any error.

--- Actual behavior ---
The test case trigger an error: 

ERROR:  variable not found in subplan target lists

--- Postgres version ---
Github commit: 3c551ebede46194237f82062b54b92e474b5c743
Version: PostgreSQL 17devel on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit

--- Platform information ---
Platform: Ubuntu 20.04
Kernel: Linux 5.4.0-147-generic



view thread (24+ messages)  latest in thread

Message-ID: <18187-831da249cbd2ff8e@postgresql.org>
Permalink:  ../18187-831da249cbd2ff8e@postgresql.org/
Also on:    postgresql.org/message-id/18187-831da249cbd2ff8e@postgresql.org

 · 

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: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, zuming.jiang@inf.ethz.ch
  Subject: Re: BUG #18187: Unexpected error: "variable not found in subplan target lists" triggered by JOIN
  In-Reply-To: <18187-831da249cbd2ff8e@postgresql.org>

* 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