Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Shafiq Far: "Just wanted to let you know that I think the SQL Maestro for Postgres is excellent. We've tried a variety over the past few years and none are even close to yours. Well done".
Jad Cooper: "Your program is the best. I have only few hours but now I make very great data for my meeting".

More

Add your opinion

PostgreSQL Maestro online Help

Prev Return to chapter overview Next

Create Function Wizard

Create Function Wizard guides you through the process of creating a new Function. See How To create Function for instructions on running this 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.

 

Specify the properties for the new Function according to your needs. The detailed description is given below.
 

 

Specifying Function properties

Name

Specify a name for the function.

 

Owner

Select the owner of the Function from the drop-down list. 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

Supply a comment to the Function if necessary.

 

Check the Returns set option to indicate that the function will return a set of items rather than a single item.

 

Return type

Defines the data type of the function result.

 

Language

The field stores the name of the language the function is implemented in. Select either of the available languages: SQL, C, internal, or the name of a u        ser-defined procedural language. For backward compatibility, the name may be enclosed by single quotes.

 

Check the Strict option to indicate that the function always returns NULL whenever any of its arguments are null. If this option is specified, the function is not executed when there are null arguments; a null result is assumed automatically instead. Uncheck the Strict option to indicate that the function will be called normally when some of its arguments are null. It is then the function author's responsibility to check for null values if necessary and to respond in the appropriate way.

 

Execution Privileges

Select Invoker to indicate that the function is to be executed with the privileges of the user that calls it (the default value).

Select Definer to specify that the function is to be executed with the privileges of the user that created it.

 

Stability

Set the attribute to inform the system whether it is safe to replace multiple evaluations of the function with a single evaluation, for run-time optimization. If none of these appear, Volatile is the default assumption.

Immutable indicates that the function always returns the same result when given the same argument values; that is, it does not do database lookups or otherwise use information not directly present in its argument list. If this option is given, any call of the function with all-constant arguments can be immediately replaced with the function value.

Stable indicates that within a single table scan the function will consistently return the same result for the same argument values, but that its result could change across SQL statements. This is the appropriate selection for the functions in which the results depend on database lookups, parameter variables (such as the current time zone), etc. Also note that the current_timestamp family of functions qualify as stable, since their values do not change within a transaction.

Volatile indicates that the function value can change even within a single table scan, so no optimizations can be made. Relatively few database functions are volatile in this sense; some examples are random(), currval(), timeofday(). Note that any function that has side-effects must be classified volatile (even if its result is quite predictable) to prevent calls from being optimized away; an example is setval().

 

Note: You can also add the function definition within the Properties tab of Function Editor.

 

Managing parameters of a new Function

Use popup menu Add New Parameter... item to add a new parameter and set its properties in Parameter Editor. Use the Edit and Delete items to manage Function parameters.

 

Specifying Function Definition

At this step you can specify the SQL definition for the new function. The step is optional: you can do it later using a non-modal editor.



Prev Return to chapter overview Next