PostgreSQL Maestro online Help
Prev | Return to chapter overview | Next |
Create Aggregate Wizard
New aggregates are created within Create Aggregate Wizard. In order to run the wizard you should either
• | select the Object | Create Database Object... main menu item; |
• | select the Aggregate icon in the Create Database Object dialog |
or
• | select the Aggregates list or any object from that list in the explorer tree; |
• | select the Create New Aggregate... item from the popup menu |
or
• | open the schema in Schema Editor and the Aggregates tab there; |
• | press the Insert key or select the Create New Aggregate item from the popup menu (alternatively, you may use the corresponding link of the Navigation Bar). |
To create a new aggregate with the same properties as one of the existing aggregates has:
• | select the Object | Duplicate Database Object... main menu item; |
• | follow the instructions of Duplicate Object Wizard. |
The basic principles of Create Object Wizards in PostgreSQL Maestro are explained in a separate topic. Below you will find a description of wizard steps that are unique for the current object.
Several options can be specified for the aggregate function that govern the expected behaviour of the function. The detailed description is given below.
Owner
Defines the owner of the new aggregate. By default, only the owner of an object can perform various operations with the object. In order to allow other users to operate it, privileges must be granted. (However, users that have the superuser attribute can always access any object.)
Comment
The box allows you to set optional text to describe the new aggregate.
Base Type
The field is used for setting the input data type on which this aggregate function operates. This can be specified as "ANY" for an aggregate that does not examine its input values (an example is count(*)).
State Type
The data type for the state value of the aggregate.
State Function
The name of the state transition function to be called for each input data value. This is normally a function of two arguments, the first being of type state type and the second of type base type. Alternatively, for an aggregate that does not examine its input values, the function takes just one argument of type state type. In either case the function must return a value of type state type. This function takes the current state value and the current input data item, and returns the next state value.
Final Function
The name of the final function called to compute the aggregate's result after all input data has been traversed. The function must take a single argument of type state type. The return data type of the aggregate is defined as the return type of this function. If final function is not specified, then the ending state value is used as the aggregate result, and the return type is state type.
Initial Condition
The initial setting for the state value. This must be a string constant in the form accepted for the data type state type. If not specified, the state value starts out null.
See also: Aggregate Editor
Prev | Return to chapter overview | Next |