Re: [HACKERS] array_accum aggregate

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org, Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Neil Conway <neilc(at)samurai(dot)com>, pgsql-patches(at)postgresql(dot)org, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: [HACKERS] array_accum aggregate
Date: 2006-10-13 16:02:02
Message-ID: 16466.1160755322@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Stephen Frost <sfrost(at)snowman(dot)net> writes:
>> That's not really the flavor of solution I'd like to have. Ideally,
>> it'd actually *work* to write
>> my_ffunc(my_sfunc(my_sfunc(null, 1), 2))

> In general I like this idea but there are some complications, the main
> one being where would the memory be allocated?

In the agg context if called with that context, else
CurrentMemoryContext will do fine.

> The other issue is, in the above scenario
> is it acceptable to modify the result of my_sfunc(null, 1) in the ,2
> call?

Yes, because the only place a nonnull value of the type could have come
from is a my_sfunc call; since it's a pseudotype, we don't allow it on
disk. (We might also need a hack to prevent the type from being used as
a record-type component ... not sure if that comes for free with being a
pseudotype currently.)

> As for a type for each such aggregate, that seems reasonable to me,
> honestly.

The ugly part is that we'd still need a way for the planner to recognize
this class of types.

> Additionally, we'd have to be
> able to mark the types as being polymorhpic along the same lines as
> anyelement/anyarray.

What for?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-10-13 16:16:14 Re: [HACKERS] Hints proposal
Previous Message Andrew - Supernews 2006-10-13 15:48:50 Re: more anti-postgresql FUD

Browse pgsql-patches by date

  From Date Subject
Next Message Zdenek Kotala 2006-10-13 16:42:51 Re: Updated version of FAQ_Solaris
Previous Message Stephen Frost 2006-10-13 15:33:43 Re: [HACKERS] array_accum aggregate