From a4ac2f458e8cb76177254f4bd7bbd885991379af Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Tue, 6 Jul 1999 17:16:42 +0000 Subject: Fix markup for docbook2man man page generation. No big deal; fixed lots of other markup at the same time. Bigest change: make sure there is no whitespace in front of contents. This will probably help the other output types too. --- doc/src/sgml/ref/create_aggregate.sgml | 440 ++++++++++++++++----------------- 1 file changed, 210 insertions(+), 230 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 e225db11efe..07cb8f15a2e 100644 --- a/doc/src/sgml/ref/create_aggregate.sgml +++ b/doc/src/sgml/ref/create_aggregate.sgml @@ -1,193 +1,175 @@ - - - + + + CREATE AGGREGATE - - SQL - Language Statements - + + SQL - Language Statements + - - + + CREATE AGGREGATE - - + + Defines a new aggregate function - + - - - 1998-09-09 - - -CREATE AGGREGATE name [ AS ] - ( BASETYPE = data_type - [ , SFUNC1 = sfunc1 - , STYPE1 = sfunc1_return_type ] - [ , SFUNC2 = sfunc2 - , STYPE2 = sfunc2_return_type ] - [ , FINALFUNC = ffunc ] - [ , INITCOND1 = initial_condition1 ] - [ , INITCOND2 = initial_condition2 ] + + + 1998-09-09 + + +CREATE AGGREGATE name [ AS ] + ( BASETYPE = data_type + [ , SFUNC1 = sfunc1 + , STYPE1 = sfunc1_return_type ] + [ , SFUNC2 = sfunc2 + , STYPE2 = sfunc2_return_type ] + [ , FINALFUNC = ffunc ] + [ , INITCOND1 = initial_condition1 ] + [ , INITCOND2 = initial_condition2 ] ) - + - - - 1998-09-09 - - + <refsect2 id="R2-SQL-CREATEAGGREGATE-1"> + <refsect2info> + <date>1998-09-09</date> + </refsect2info> + <title> Inputs - - - - - - name - - - - The name of an aggregate function to create. - - - + + + + + name + + + The name of an aggregate function to create. + + + - - - data_type - - - -The fundamental data type on which this aggregate function operates. - - - + + data_type + + + The fundamental data type on which this aggregate function operates. + + + - - - sfunc1 - - - -The state transition function - to be called for every non-NULL field from the source column. - It takes a variable of -type sfunc1_return_type as -the first argument and that field as the -second argument. - - - + + sfunc1 + + + The state transition function + to be called for every non-NULL field from the source column. + It takes a variable of + type sfunc1_return_type as + the first argument and that field as the + second argument. + + + - - - sfunc1_return_type - - - -The return type of the first transition function. - - - + + sfunc1_return_type + + + The return type of the first transition function. + + + - - - sfunc2 - - - -The state transition function - to be called for every non-NULL field from the source column. -It takes a variable -of type sfunc2_return_type -as the only argument and returns a variable of the same type. - - - + + sfunc2 + + + The state transition function + to be called for every non-NULL field from the source column. + It takes a variable + of type sfunc2_return_type + as the only argument and returns a variable of the same type. + + + - - - sfunc2_return_type - - - -The return type of the second transition function. - - - + + sfunc2_return_type + + + The return type of the second transition function. + + + - - - ffunc - - - -The final function - called after traversing all input fields. This function must -take two arguments of types - sfunc1_return_type -and -sfunc2_return_type. - - - + + ffunc + + + The final function + called after traversing all input fields. This function must + take two arguments of types + sfunc1_return_type + and + sfunc2_return_type. + + + - - - initial_condition1 - - - -The initial value for the first transition function argument. - - - + + initial_condition1 + + + The initial value for the first transition function argument. + + + - - - initial_condition2 - - - -The initial value for the second transition function argument. - - + + initial_condition2 + + + The initial value for the second transition function argument. + + - - - - - 1998-09-09 - - + </refsect2> + + <refsect2 id="R2-SQL-CREATEAGGREGATE-2"> + <refsect2info> + <date>1998-09-09</date> + </refsect2info> + <title> Outputs - - - - - - - CREATE - - - + + + + + + +CREATE + + + Message returned if the command completes successfully. - + - - - - - - 1998-09-09 - - + </refsect2> + </refsynopsisdiv> + + <refsect1 id="R1-SQL-CREATEAGGREGATE-1"> + <refsect1info> + <date>1998-09-09</date> + </refsect1info> + <title> Description - + CREATE AGGREGATE allows a user or programmer to extend Postgres @@ -198,25 +180,24 @@ The initial value for the second transition function argument. 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 + and sfunc2: - sfunc1( internal-state1, next-data_item ) ---> next-internal-state1 - sfunc2( internal-state2 ) ---> next-internal-state2 +sfunc1( internal-state1, next-data_item ) ---> next-internal-state1 sfunc2( internal-state2 ) ---> next-internal-state2 and a final calculation function, - ffunc: + ffunc: - ffunc(internal-state1, internal-state2) ---> aggregate-value +ffunc(internal-state1, internal-state2) ---> aggregate-value Postgres creates up to two temporary variables - (referred to here as temp1 - and temp2) + (referred to here as temp1 + and temp2) to hold intermediate results used as arguments to the transition functions. @@ -225,42 +206,42 @@ The initial value for the second transition function argument. The arguments to - sfunc1 + sfunc1 must be - temp1 + temp1 of type - sfunc1_return_type + sfunc1_return_type and - column_value - of type data_type. + column_value + of type data_type. The return value must be of type - sfunc1_return_type + sfunc1_return_type and will be used as the first argument in the next call to - sfunc1. + sfunc1. The argument and return value of - sfunc2 + sfunc2 must be - temp2 + temp2 of type - sfunc2_return_type. + sfunc2_return_type. The arguments to the final-calculation-function must be - temp1 + temp1 and - temp2 + temp2 and its return value must be a Postgres base type (not necessarily - data_type + data_type which had been specified for BASETYPE). @@ -269,10 +250,9 @@ The initial value for the second transition function argument. FINALFUNC should be specified if and only if both state-transition functions are specified. - + - + An aggregate function may also require one or two initial conditions, @@ -281,72 +261,72 @@ The initial value for the second transition function argument. in the database as fields of type text. - - - 1998-09-09 - - + <refsect2 id="R2-SQL-CREATEAGGREGATE-3"> + <refsect2info> + <date>1998-09-09</date> + </refsect2info> + <title> Notes - + Use DROP AGGREGATE - to drop aggregate functions. + to drop aggregate functions. - - It is possible to specify aggregate functions - that have varying combinations of state and final functions. - For example, the count aggregate requires SFUNC2 - (an incrementing function) but not SFUNC1 or FINALFUNC, - whereas the sum aggregate requires SFUNC1 (an addition - function) but not SFUNC2 or FINALFUNC and the avg - aggregate requires - both of the above state functions as - 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. + + It is possible to specify aggregate functions + that have varying combinations of state and final functions. + For example, the count aggregate requires SFUNC2 + (an incrementing function) but not SFUNC1 or FINALFUNC, + whereas the sum aggregate requires SFUNC1 (an addition + function) but not SFUNC2 or FINALFUNC and the avg + aggregate requires + both of the above state functions as + 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. - - + + - - + <refsect1 id="R1-SQL-CREATEAGGREGATE-2"> + <title> Usage - - + + Refer to the chapter on aggregate functions in the PostgreSQL Programmer's Guide on aggregate functions for complete examples of usage. - - - - + </refsect1> + + <refsect1 id="R1-SQL-CREATEAGGREGATE-3"> + <title> Compatibility - - - - - 1998-09-09 - - + + + + + 1998-09-09 + + SQL92 - - + + CREATE AGGREGATE is a Postgres language extension. There is no CREATE AGGREGATE in SQL92. - + - +