[GENERAL] is this a known bug in 9.6? - Mailing list pgsql-general

From Torsten Förtsch
Subject [GENERAL] is this a known bug in 9.6?
Date
Msg-id CAKkG4_=gjY5QiHtqSZyWMwDuTd_CftKoTaCqxjJ7uUz1-Gw=qw@mail.gmail.com
Whole thread Raw
Responses Re: [GENERAL] is this a known bug in 9.6?
List pgsql-general
Hi,

this is a stock PGDG 9.6:

postgres=# with i(x) as (values (1::int)), j(y) as (values (2::int)) select x from (select x from i union all select y from j) b;      
x  
---
1
2
(2 rows)

postgres=# with i(x) as (values (1::int)), j(y) as (values (2::int)) select max(x) from (select x from i union all select y from j) b;
ERROR:  could not find plan for CTE "i"

The same on 9.5:

postgres=# with i(x) as (values (1::int)), j(y) as (values (2::int)) select x from (select x from i union all select y from j) b;      
x  
---
1
2
(2 rows)

postgres=# with i(x) as (values (1::int)), j(y) as (values (2::int)) select max(x) from (select x from i union all select y from j) b;
max  
-----
  2
(1 row)

Is this a bug or is my assumption that this should work wrong?

Both the aggregate and the UNION are required to trigger the bug:

postgres=# with i(x) as (values (1::int)) select x from (select x from i union all select 3::int) b;      
x  
---
1
3
(2 rows)

postgres=# with i(x) as (values (1::int)) select max(x) from (select x from i) b;                         
max  
-----
  1
(1 row)

postgres=# with i(x) as (values (1::int)) select max(x) from (select x from i union all select 3::int) b;
ERROR:  could not find plan for CTE "i"


Thanks,
Torsten

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: [GENERAL] pg_upgrade 9.0 to 9.6
Next
From: Dorian Hoxha
Date:
Subject: [GENERAL] When updating row that has TOAST column, is the TOAST column alsoreinserted ? Or just the oid to the value?