From: | Benedikt Grundmann <benedikt(dot)grundmann(at)gmail(dot)com> |
---|---|
To: | Alban Hertroys <haramrae(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Expression to construct a anonymous record with named columns? |
Date: | 2012-09-21 09:18:48 |
Message-ID: | CAMr3DCMJz=4d8eH2FK1qg4-+uZ7AZAFiCpXMmF66j30-X=16fw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 21 September 2012 07:50, Alban Hertroys <haramrae(at)gmail(dot)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)
proddb_testing=# select (select x from (values (1, 2, 3)) x (a, b, c)).*;
ERROR: syntax error at or near "."
LINE 1: select (select x from (values (1, 2, 3)) x (a, b, c)).*;
^
proddb_testing=# select (select x from (values (1, 2, 3)) x (a, b, c)).a;
ERROR: syntax error at or near "."
LINE 1: select (select x from (values (1, 2, 3)) x (a, b, c)).a;
Any more insights?
Thanks,
bene
From | Date | Subject | |
---|---|---|---|
Next Message | Roger Leigh | 2012-09-21 09:40:45 | Re: Using psql -f to load a UTF8 file |
Previous Message | Carrington, Matthew (Produban) | 2012-09-21 08:46:46 | Re: pg_upgrade: out of memory |