Re: [PATCHES] array_accum aggregate - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] array_accum aggregate
Date
Msg-id 20443.1160693932@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCHES] array_accum aggregate  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCHES] array_accum aggregate
List pgsql-hackers
I wrote:
> aggregate_state would have no other uses in the system, and its input
> and output functions would raise an error, so type safety is assured
> --- there would be no way to call either the sfunc or ffunc "manually",
> except by passing a NULL value, which should be safe because that's what
> they'd expect as the aggregate initial condition.

Um, no, I take that back, unless you want to invent a separate
pseudotype for each such aggregate.  Otherwise you can crash it with

    my_ffunc(your_sfunc(null, whatever))

because my_ffunc will be expecting a datastructure different from what
it gets.

Maybe having a check for AggState call context is enough of a defense for
that, but I'm not really satisfied.  Back to the drawing board ...

            regards, tom lane

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql: Stamp 7.3.16.
Next
From: Bruce Momjian
Date:
Subject: Re: [COMMITTERS] pgsql: Stamp 7.3.16.