Re: Array aggregation. Was: PostgreSQL Final Release ... Monday?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hannu Krosing <hannu(at)krosing(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Array aggregation. Was: PostgreSQL Final Release ... Monday?
Date: 2002-02-01 22:46:52
Message-ID: 13500.1012603612@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hannu Krosing <hannu(at)krosing(dot)net> writes:
> 2. Is there a way to define a function such that

> declare make_array(any) returns any[] ?

No. We do need a way to construct an array as an expression result,
but I think it will have to be a special syntactic case, not an ordinary
function. Maybe something roughly like a CAST construct,
ARRAY(expr,expr,expr,... OF type-name)

The function definition language isn't nearly powerful enough to deal
with this --- heck, we don't even support a variable number of
arguments. If it were, it'd probably break the whole ambiguous-
function-call resolution mechanism --- what type do you assign to the
output if you're not entirely sure how the inputs are to be interpreted?

> 3. Also, can I prescribe order of aggregation (aggregation applied
> _after_ ORDER BY) that would act in a way similar to HAVING .

Sub-select in FROM might help here.

> 4. what arguments must I give to array_in so that it produces an
> array of specific kind ?

You don't. array_in is meant to be used as the declared typinput
routine for an array type; that linkage is what causes the system
to know what the output array type is. array_in by itself can't
cause the system to assign a correct type to its result.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-02-01 22:57:59 Re: Syscaches should store negative entries, too
Previous Message Frank Wiles 2002-02-01 22:45:17 Re: TODO Perl documentation question