From a75f2d21a8366aece67b8aa144a8644f6195e75f Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Tue, 29 Dec 1998 02:24:47 +0000 Subject: Clean up to ensure tag completion as required by the newest versions of Norm's Modular Style Sheets and jade/docbook. From Vince Vielhaber . --- doc/src/sgml/ref/create_aggregate.sgml | 171 +++++++++++++++++---------------- 1 file changed, 88 insertions(+), 83 deletions(-) (limited to 'doc/src/sgml/ref/create_aggregate.sgml') diff --git a/doc/src/sgml/ref/create_aggregate.sgml b/doc/src/sgml/ref/create_aggregate.sgml index 273d6087a9..e225db11ef 100644 --- a/doc/src/sgml/ref/create_aggregate.sgml +++ b/doc/src/sgml/ref/create_aggregate.sgml @@ -13,6 +13,7 @@ Defines a new aggregate function + 1998-09-09 @@ -150,11 +151,11 @@ The initial value for the first transition function argument. The initial value for the second transition function argument. - - - + + + - + 1998-09-09 @@ -163,20 +164,23 @@ The initial value for the second transition function argument. Outputs - - - - - CREATE - - - - Message returned if the command completes successfully. - - + + + + + CREATE + + + + Message returned if the command completes successfully. + + + + + - + 1998-09-09 @@ -184,80 +188,80 @@ The initial value for the second transition function argument. Description - - CREATE AGGREGATE -allows a user or programmer to extend Postgres -functionality by defining new aggregate functions. Some aggregate functions -for base types such as min(int4) - and avg(float8) are already provided in the base -distribution. If one defines new types or needs an aggregate function not -already provided then CREATE AGGREGATE -can be used to provide the desired features. - + + CREATE AGGREGATE + allows a user or programmer to extend Postgres + functionality by defining new aggregate functions. Some aggregate functions + for base types such as min(int4) + and avg(float8) are already provided in the base + distribution. If one defines new types or needs an aggregate function not + already provided then CREATE AGGREGATE + can be used to provide the desired features. + An aggregate function can require up to three functions, two state transition functions, -sfunc1 - and sfunc2: - -sfunc1( internal-state1, next-data_item ) ---> next-internal-state1 -sfunc2( internal-state2 ) ---> next-internal-state2 - + sfunc1 + and sfunc2: + + sfunc1( internal-state1, next-data_item ) ---> next-internal-state1 + sfunc2( internal-state2 ) ---> next-internal-state2 + and a final calculation function, - ffunc: - -ffunc(internal-state1, internal-state2) ---> aggregate-value - - - -Postgres creates up to two temporary variables -(referred to here as temp1 -and temp2) -to hold intermediate results used as arguments to the transition functions. - - + ffunc: + + ffunc(internal-state1, internal-state2) ---> aggregate-value + + + + Postgres creates up to two temporary variables + (referred to here as temp1 + and temp2) + to hold intermediate results used as arguments to the transition functions. + + These transition functions are required to have the following properties: The arguments to -sfunc1 - must be -temp1 -of type -sfunc1_return_type -and -column_value -of type data_type. -The return value must be of type -sfunc1_return_type -and will be used as the first argument in the next call to -sfunc1. + sfunc1 + must be + temp1 + of type + sfunc1_return_type + and + column_value + of type data_type. + The return value must be of type + sfunc1_return_type + and will be used as the first argument in the next call to + sfunc1. - + The argument and return value of -sfunc2 -must be -temp2 -of type -sfunc2_return_type. + sfunc2 + must be + temp2 + of type + sfunc2_return_type. The arguments to the final-calculation-function must be -temp1 -and -temp2 -and its return value must + temp1 + and + temp2 + and its return value must be a Postgres - base type (not necessarily - data_type -which had been specified for BASETYPE). + base type (not necessarily + data_type + which had been specified for BASETYPE). @@ -269,7 +273,7 @@ which had been specified for BASETYPE). - + An aggregate function may also require one or two initial conditions, one for @@ -301,41 +305,42 @@ which had been specified for BASETYPE). well as a FINALFUNC (a division function) to produce its answer. In any case, at least one state function must be defined, and any SFUNC2 must have a corresponding INITCOND2. - - + + - + + Usage -Refer to the chapter on aggregate functions - in the PostgreSQL Programmer's Guide - on aggregate functions for -complete examples of usage. - + Refer to the chapter on aggregate functions + in the PostgreSQL Programmer's Guide + on aggregate functions for + complete examples of usage. + Compatibility - - + -1998-09-09 + 1998-09-09 SQL92 CREATE AGGREGATE -is a Postgres language extension. + is a Postgres language extension. There is no CREATE AGGREGATE in SQL92. - + +