is this a known bug in 9.6?

From: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: is this a known bug in 9.6?
Date: 2016-12-13 11:42:02
Message-ID: CAKkG4_=gjY5QiHtqSZyWMwDuTd_CftKoTaCqxjJ7uUz1-Gw=qw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dorian Hoxha 2016-12-13 13:09:32 When updating row that has TOAST column, is the TOAST column also reinserted ? Or just the oid to the value?
Previous Message John R Pierce 2016-12-13 10:34:08 Re: pg_upgrade 9.0 to 9.6