Re: creating aggregates that work on composite types

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: creating aggregates that work on composite types
Date: 2002-07-30 16:06:57
Message-ID: 1028045217.10669.9.camel@taru.tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 2002-07-30 at 16:49, Tom Lane wrote:
> Hannu Krosing <hannu(at)tm(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-07-30 16:24:43 Re: Password sub-process ...
Previous Message Bruce Momjian 2002-07-30 15:55:15 Re: Password sub-process ...