Re: BUG #13539: ERROR: record type has not been registered with CTE and subselect in target list

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Maciek Sakrejda <maciek(at)heroku(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13539: ERROR: record type has not been registered with CTE and subselect in target list
Date: 2015-08-06 03:21:31
Message-ID: CAKFQuwZ9jkP8YQH36Cpwc8aTWwrMwUkawHqYx3Tik9tmTVZszA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Aug 5, 2015 at 5:57 PM, <maciek(at)heroku(dot)com> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 13539
> Logged by: Maciek Sakrejda
> Email address: maciek(at)heroku(dot)com
> PostgreSQL version: 9.4.4
> Operating system: Ubuntu 15.04
> Description:
>
> I'm not sure if this is a legitimate bug, but the error message is unclear.
> I've searched for this message and have seen reports of similar errors, but
> the SQL is somewhat different, so I thought I'd report it:
>
> maciek=# with foo(a) as (select 1) select (select (foo) from foo).* from
> foo;
> ERROR: record type has not been registered
>
> I know how to work around it; just reporting it in the hope of maybe
> getting
> a clearer error.
>

​Suggestions are welcomed though this is an existing limitation of
PostgreSQL. The planner does not capture enough information to deal with
constructs of the form (ROW(...)).* ​
regardless of how they were formed. The above is the equivalent to:
SELECT (foo.foo_val).* FROM ( VALUES (ROW(1)) ) foo (foo_val) which is
likewise unresolvable.

​Something like: "wildcard expansion of uncataloged ​record type not
possible" ?

To my recollection the concept of "type registration" is not used in the
user documentation. Uncataloged at least implies that using CREATE TYPE
(or table/view implicitly) to add a named type to the system type catalog
would resolve the problem. Though an implied "create function returns
table" type does get "registered" in the planner so maybe that is too
specific...

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2015-08-06 03:33:01 Re: BUG #13539: ERROR: record type has not been registered with CTE and subselect in target list
Previous Message maciek 2015-08-06 00:57:21 BUG #13539: ERROR: record type has not been registered with CTE and subselect in target list