public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Josh Berkus <[email protected]>
Cc: [email protected]
Subject: Re: More missing docs (aggs)
Date: Mon, 11 Dec 2006 12:38:20 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
Josh Berkus <[email protected]> writes:
>> Uh, why do you think that's significant? The stype is whatever you
>> need to use.
> Right, but do you have two stypes for a multi-col, a single stype, or a
> composite stype? The docs don't say and it's not obvious.
There is only one transition state variable, as I should think would be
reasonably obvious from the wording:
An aggregate function is made from one or two ordinary functions: a
state transition function sfunc, and an optional final calculation
function ffunc. These are used as follows:
sfunc( internal-state, next-data-values ) ---> next-internal-state
ffunc( internal-state ) ---> aggregate-value
PostgreSQL creates a temporary variable of data type stype to hold
the current internal state of the aggregate. At each input row, the
aggregate argument value(s) are calculated and the state transition
function is invoked with the current state value and the new
argument value(s) to calculate a new internal state value.
Whether the state value is a composite type or not is up to the
aggregate author. There aren't any examples of using a composite type
in the docs, but there are examples of using an array as stype, so
I would hope that our users are bright enough to think of composites
when they need one.
regards, tom lane
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: More missing docs (aggs)
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox