Re: is 8.4 array_agg() supposed to work with array values?

From: "Todd A(dot) Cook" <tcook(at)blackducksoftware(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: is 8.4 array_agg() supposed to work with array values?
Date: 2009-01-21 16:01:24
Message-ID: 497746D4.1050606@blackducksoftware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut wrote:
> On Monday 19 January 2009 23:22:21 Todd A. Cook wrote:
>> The docs at
>> http://developer.postgresql.org/pgdocs/postgres/functions-aggregate.html
>> don't prohibit using array values with array_arg(), so I assumed that it
>> would work.
>
>> test=> select array_agg(v.a) from (values (array[1,2]), (array[3,4])) as
>> v(a) ; ERROR: could not find array type for data type integer[]
>
> Yeah ... This is one of the weirdnesses of the PostgreSQL array
> implementation. integer[] and integer[][] etc. are actually the same type,
> just using a different number of dimensions internally. This would work much
> better if integer[][] where "array of integer[]", in the same way as
> integer[] is "array of integer", in the way C deals with arrays. This is
> also a main reason why composite types and arrays don't mix orthogonally;
> there is no way to represent that in the system catalogs. To get back to
> your question, as far as array_agg() itself is concerned, it would probably
> work, but the rest of the sytem doesn't deal with it very well. You will
> probably be able to find a number of other places that break when trying to
> derive the array type from something that is already an array.

Thanks for the clarification.

-- todd

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2009-01-21 16:01:41 Re: pg_restore -1 vs -C and -c
Previous Message Peter Eisentraut 2009-01-21 15:54:41 Re: Re: [COMMITTERS] pgsql: Explicitly bind gettext() to the UTF8 locale when in use.