Re: array functions - request for opinions (was Re: [PATCHES]

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: array functions - request for opinions (was Re: [PATCHES]
Дата
Msg-id 3ED22D99.40902@joeconway.com
обсуждение исходный текст
Ответ на Re: array functions - request for opinions (was Re: [PATCHES] array  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: array functions - request for opinions (was Re: [PATCHES]  (Andreas Pflug <Andreas.Pflug@web.de>)
Re: array functions - request for opinions (was Re: [PATCHES] array  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Peter Eisentraut wrote:
> Joe Conway writes:
>>There are many discussions on the lists over the past few years in which
>>people have requested this kind of functionality. There is even a
>>contrib/intagg that does this for integers only. I don't think there is
>>any question that there is a demand for the feature. Some examples:
> 
> These applications should use an empty array as initial value.  Then the
> normal array concatenation can be used as transition function.

How can you create an aggregate using an operator as a transition function?

=# CREATE AGGREGATE myagg
-# (
(#   BASETYPE = text,
(#   SFUNC = '||',
(#   STYPE = text,
(#   INITCOND = ''
(# );
ERROR:  AggregateCreate: function ||(text, text) does not exist

Also (I suppose you could argue this should be fixed, but anyway...), 
you can't currently add elements to an empty array.

regression=# create table t(f float8[]);
CREATE TABLE
regression=# insert into t values('{}');
INSERT 1865486 1
regression=# update t set f[1] = 1;
ERROR:  Invalid array subscripts
regression=# select array_dims(f) from t; array_dims
------------

(1 row)

Joe



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera Munoz
Дата:
Сообщение: Re: Bug(s) or not?
Следующее
От: Joe Conway
Дата:
Сообщение: Re: IS OF