From: | Arjen Nienhuis <a(dot)g(dot)nienhuis(at)gmail(dot)com> |
---|---|
To: | Rikard Pavelic <rikard(dot)pavelic(at)zg(dot)htnet(dot)hr> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: unintuitive subquery record wrapping |
Date: | 2010-09-18 09:36:13 |
Message-ID: | AANLkTikr-tT2-z8Bfx9vOQXn703CroXvVUkUgtv2or+t@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sat, Sep 18, 2010 at 9:31 AM, Rikard Pavelic
<rikard(dot)pavelic(at)zg(dot)htnet(dot)hr> wrote:
> On 18.9.2010 4:31, Tom Lane wrote:
>> Rikard Pavelic <rikard(dot)pavelic(at)zg(dot)htnet(dot)hr> writes:
>>
>>> For basic query:
>>> select t from t
>>> result is of type t.
>>>
>> yeah ...
>>
>>
>>> If I query:
>>> select sq from (select t from t) sq;
>>> result is of type record.
>>>
>> yeah ... it's a record containing a single field of type t.
>>
>> regards, tom lane
>>
>>
> That was unhelpful ;(
>
> You removed the important part of question ;)
> I'll try again...
>
> I'm arguing that is seems wrong that I need to match alias name like this
> select t from (select t from t) t
> or like this
> select sq from (select sq from t sq) sq
> to get unwrapped type.
>
> Maybe I'm alone arguing this because nobody writes queries like that :)
>
> Regards,
> Rikard
I'm not sure what you want but maybe it's this:
=> select * from (select t from t) sq;
t
-------
(1,x)
(1 row)
=> select (sq.t).* from (select t from t) sq;
a | b
---+---
1 | x
(1 row)
From | Date | Subject | |
---|---|---|---|
Next Message | Rikard Pavelic | 2010-09-18 10:40:03 | Re: unintuitive subquery record wrapping |
Previous Message | Rikard Pavelic | 2010-09-18 07:31:29 | Re: unintuitive subquery record wrapping |