Re: Over-optimization in ExecEvalWholeRowVar

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Over-optimization in ExecEvalWholeRowVar
Date: 2014-07-14 14:47:33
Message-ID: CAHyXU0xrVUwuR9LqRD2DVstjRB_2CoaKTOCWpBM_3CQxbWzL+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 11, 2014 at 2:43 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> This example in the regression database is a simplified version of a bug
> I was shown off-list:
>
> regression=# select (
> select q from
> ( select 1,2,3 where f1>0
> union all
> select 4,5,6.0 where f1<=0
> ) q
> )
> from int4_tbl;
> ERROR: record type has not been registered

Thanks Tom!

If anybody gets hit by this, the workaround I use is to put the inner
subquery as a CTE:

select (
select q from
(
with data as (
select 1,2,3 where f1>0
union all
select 4,5,6.0 where f1<=0
)
select * from data
) q
)
from int4_tbl;

merlin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-07-14 14:50:59 Re: Allowing NOT IN to use ANTI joins
Previous Message Fabrízio de Royes Mello 2014-07-14 13:57:16 Re: 9.5 CF1