public inbox for [email protected]help / color / mirror / Atom feed
More missing docs (aggs) 5+ messages / 2 participants [nested] [flat]
* More missing docs (aggs) @ 2006-12-06 05:41 Josh Berkus <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Josh Berkus @ 2006-12-06 05:41 UTC (permalink / raw) To: pgsql-docs Folks, So I don't forget this: The docs do not have an example of creating a multi-column aggregate, and the syntax is NOT obvious. For example, what do you use for stype in a multi-col aggregate? --Josh ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: More missing docs (aggs) @ 2006-12-06 05:50 Tom Lane <[email protected]> parent: Josh Berkus <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Tom Lane @ 2006-12-06 05:50 UTC (permalink / raw) To: Josh Berkus <[email protected]>; +Cc: pgsql-docs Josh Berkus <[email protected]> writes: > The docs do not have an example of creating a multi-column aggregate, True... > and the syntax is NOT obvious. For example, what do you use for stype > in a multi-col aggregate? Uh, why do you think that's significant? The stype is whatever you need to use. regards, tom lane ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: More missing docs (aggs) @ 2006-12-11 17:29 Josh Berkus <[email protected]> parent: Tom Lane <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Josh Berkus @ 2006-12-11 17:29 UTC (permalink / raw) To: Tom Lane <[email protected]>; +Cc: pgsql-docs Tom, > 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. -- Josh Berkus PostgreSQL @ Sun San Francisco ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: More missing docs (aggs) @ 2006-12-11 17:38 Tom Lane <[email protected]> parent: Josh Berkus <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Tom Lane @ 2006-12-11 17:38 UTC (permalink / raw) To: Josh Berkus <[email protected]>; +Cc: pgsql-docs 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 ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: More missing docs (aggs) @ 2006-12-11 17:44 Josh Berkus <[email protected]> parent: Tom Lane <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Josh Berkus @ 2006-12-11 17:44 UTC (permalink / raw) To: Tom Lane <[email protected]>; +Cc: pgsql-docs Tom, > 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. Aha, got it. OK, so this just needs a good example ... will try to think of one. -- Josh Berkus PostgreSQL @ Sun San Francisco ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2006-12-11 17:44 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2006-12-06 05:41 More missing docs (aggs) Josh Berkus <[email protected]> 2006-12-06 05:50 ` Tom Lane <[email protected]> 2006-12-11 17:29 ` Josh Berkus <[email protected]> 2006-12-11 17:38 ` Tom Lane <[email protected]> 2006-12-11 17:44 ` Josh Berkus <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox