Re: creating aggregates that work on composite types - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: creating aggregates that work on composite types
Date
Msg-id 1028045217.10669.9.camel@taru.tm.ee
Whole thread Raw
In response to Re: creating aggregates that work on composite types (whole tuples)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, 2002-07-30 at 16:49, Tom Lane wrote:
> Hannu Krosing <hannu@tm.ee> writes:
> > I am trying to create an aggregate function that works on whole tuples,
> > but the system does not find them once defined ;(
> > hannu=# select tabulate(users) from users;
> > ERROR:  No such attribute or function 'tabulate'
> 
> This seems to work in CVS tip.

That's great news.

What I really would want is to be able to register and call the same
function for "any" input, like count(*) is currently, only with the
exception that the rows are actually passed to it.

I think that could be made possible sometime in the future with either
registering for 'any' and anonymous types created on-the-fly or some
sort of tuple "supertype" that any type of row could be cast into,
either implicitly or explicitly so that I could register ggregate
tabulate(tupletype)

I would not mind having to do tabulate(tupletype(users)) but it would be
nice if it were done automatically.

> I think you're stuck in older releases
> though.  The syntax "foo(tablename)" is understood to mean "either a
> column selection or a function call" ... but aggregates were quite
> distinct from plain functions up until about a month ago, and they
> weren't considered as an option at that spot in the code.

Thanks, I'll check it on CVS tip.

---------------
Hannu



pgsql-hackers by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: Password sub-process ...
Next
From: "Luis Alberto Amigo Navarro"
Date:
Subject: Re: Question about LWLockAcquire's use of semaphores instead