Re: (SETOF) RECORD AS complex_type - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: (SETOF) RECORD AS complex_type
Date
Msg-id 55062.24.211.165.134.1167264715.squirrel@www.dunslane.net
Whole thread Raw
In response to Re: (SETOF) RECORD AS complex_type  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: (SETOF) RECORD AS complex_type
List pgsql-hackers
Tom Lane wrote:
> David Fetter <david@fetter.org> writes:
>> On Wed, Dec 27, 2006 at 06:22:17PM -0500, Tom Lane wrote:
>>> The problem with that is that "AS foo" already has a meaning, and it's
>>> not this one.
>
>> How about "AS (foo)" ?
>
> What if you want to specify an alias?  This doesn't work:
>
>     FROM myverylongfunctionname(...) AS alias(typename)
>
> because, again, that syntax already has a meaning.
>
> You could possibly do something with a cast:
>
>     FROM CAST(myfunc(...) AS typename) [ AS alias ]
>
> This is at least syntactically OK.  Not sure what the implementation
> issues might be.
>


For some time now I have wanted to genaralise the use of LIKE in type
expressions, which might perhaps fit David's need. Something like
 SELECT * from foo() AS bar (LIKE blurfl);

The nice thing about this is that you could augment the type expression:
 SELECT * from foo() AS bar (extra_info text, LIKE blurfl);

cheers

andrew



pgsql-hackers by date:

Previous
From: Roman Kononov
Date:
Subject: Re: [PATCHES] [BUGS] BUG #2846: inconsistent and confusing handling
Next
From: David Fetter
Date:
Subject: Re: (SETOF) RECORD AS complex_type