Re: Expression to construct a anonymous record with named columns? - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Expression to construct a anonymous record with named columns?
Date
Msg-id CAHyXU0zzmkTfEsCGchXKnKm47YMBNwLd_5u-9A3QCiLPvzRJpw@mail.gmail.com
Whole thread Raw
In response to Re: Expression to construct a anonymous record with named columns?  (Benedikt Grundmann <benedikt.grundmann@gmail.com>)
Responses Re: Expression to construct a anonymous record with named columns?
List pgsql-general
On Fri, Sep 21, 2012 at 4:18 AM, Benedikt Grundmann
<benedikt.grundmann@gmail.com> wrote:
>
> On 21 September 2012 07:50, Alban Hertroys <haramrae@gmail.com> wrote:
>>
>> On 20 Sep 2012, at 20:36, Benedikt Grundmann wrote:
>>
>> > So named anonymous records / row types seem to be strangely second
>> > class.  Can somebody clarify the restrictions and rationale or even better
>> > show a way to do the equivalent of (made up syntax ahead):
>> >
>> > select row(1 as a, 2 as b);
>>
>> select * from (values (1, 2, 3)) a (a, b, c);
>>
> Thank you very much.  This is very interesting. However this again seems
> to be strangely limited, because I can neither extract a column from row
> that was constructed this way in a scalar position nor expand it:
>
> proddb_testing=# select (select x from (values (1, 2, 3)) x (a, b, c));
>  ?column?
> ----------
>  (1,2,3)
> (1 row)

select * from (values (1, 2, 3)) x (a, b, c);
select x.* from (values (1, 2, 3)) x (a, b, c);

:-)

merlin


pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: Why csvlog logs contexts without leading tab?
Next
From: salah jubeh
Date:
Subject: 9.1 vs 8.4 performance