Re: is this a known bug in 9.6?

From: Torsten Förtsch <tfoertsch123(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: is this a known bug in 9.6?
Date: 2016-12-13 16:40:43
Message-ID: CAKkG4_kvVdy64m+uzXBH7LkLMhFeEMMwyg28Ms7QOn4gs0Rt1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for confirming.

Here are a few more examples that also work:

with i(x) as (values (1::int)) select x from (select x from i union all
select 3::int) b order by x desc limit 1;

with i(x) as (values (1::int)) select max(x) from (select x from i union
select 3::int) b;

It also works with EXCEPT or INTERSECT, both with or without ALL.

The UNION ALL version fails with MIN and MAX but it works with all other
aggregates that I have tested.

On Tue, Dec 13, 2016 at 4:31 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> =?UTF-8?Q?Torsten_F=C3=B6rtsch?= <tfoertsch123(at)gmail(dot)com> writes:
> > 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"
>
> Yup, sure looks like a bug to me, especially since it seems to work as
> expected before 9.5. No idea offhand what broke it.
>
> regards, tom lane
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2016-12-13 16:43:10 Re: pg_dump and quoted identifiers
Previous Message Thomas Kellerer 2016-12-13 16:38:15 pg_dump and quoted identifiers