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

From: Joe Conway <mail(at)joeconway(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: array functions - request for opinions (was Re: [PATCHES]
Date: 2003-05-26 15:07:05
Message-ID: 3ED22D99.40902@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2003-05-26 15:57:17 Re: IS OF
Previous Message Alvaro Herrera Munoz 2003-05-26 14:23:20 Re: Bug(s) or not?