From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | "David Fetter" <david(at)fetter(dot)org> |
Cc: | "Robert Haas" <robertmhaas(at)gmail(dot)com>, "postgres hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: is any reason why only one columns subselect are allowed in array()? |
Date: | 2008-11-18 16:19:12 |
Message-ID: | 162867790811180819s21392b05oc90212c6e98155b6@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2008/11/18 David Fetter <david(at)fetter(dot)org>:
> On Tue, Nov 18, 2008 at 10:29:53AM -0500, Robert Haas wrote:
>> On Tue, Nov 18, 2008 at 10:06 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> > Hello
>> >
>> > I am thinking about allowing 2D array from multicolumn subselect
>> > (all columns have to share same type, ofcourse). Is there some
>> > real limit, why this functionality is disallowed?
>>
>> Seems like you could just write SELECT ARRAY[col1, col2, col3]
>> instead of SELECT col1, col2, col3.
>
> If I understand this right, Pavel is thinking that
>
> ARRAY(SELECT col1, col2, col3...)
>
> should produce an array each element of which is the compound type
> consisting of (col1, col2, col3), and if it doesn't produce one, we're
> looking at a pretty large POLA violation.
>
yes, I though this.
there are some not necessary limits, because we should some operations:
postgres=# select array(select array[a,b] from foo);
ERROR: could not find array type for datatype integer[]
postgres=# select array(select * from foo);
ERROR: subquery must return only one column
LINE 1: select array(select * from foo);
postgres=# select array[[1,2]]||array[[1,3]];
?column?
---------------
{{1,2},{1,3}}
(1 row)
so I don't see reason why dis feature are blocked
regards
Pavel Stehule
> Cheers,
> David.
> --
> David Fetter <david(at)fetter(dot)org> http://fetter.org/
> Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
> Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
>
> Remember to vote!
> Consider donating to Postgres: http://www.postgresql.org/about/donate
>
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2008-11-18 16:20:27 | Re: is any reason why only one columns subselect are allowed in array()? |
Previous Message | Zdenek Kotala | 2008-11-18 16:10:28 | Re: Re: toast by chunk-end (was Re: PG_PAGE_LAYOUT_VERSION 5 - time for change) |