Online Documentation for SQL Manager for PostgreSQL
Use the Function tab of Function Editor to create/edit a function and specify its definition.
Select a schema and enter a name for the new function, or modify the name of the function being edited.
Use this options to define what data is to return by the function:
Single value - the function returns a single item; to define its type use the drop-down list.
Set of values - the function returns a set of items; define its type using the drop-down list.
Table - the function returns table; define its type using the Return table field (for Postgres 9.1 and higher).
Nothing - the function returns void.
Trigger - the function returns a trigger.
The Arguments list provides the following attributes of each argument used in the function:
Type (the argument data type)
Mode (in, out, in/out)
Set the function arguments by right-clicking in the list and selecting Add Argument. Once the argument is added, select its type from the Argument Type drop-down list. To delete the existing argument, select Delete Argument from the popup menu. To reorder the arguments within the list, use the Move Up and Move Down items or the corresponding Ctrl+Up/Ctrl+Down shortcuts.
It is possible to set the argument names for server version 8.0 and higher.
Hint: You can reorder arguments in the list using the Move Up and Move Down popup menu items.
Select the language that the function is implemented in: SQL, C, internal, or the name of a user-defined procedural language.
Returns NULL on NULL input
This option indicates that the function always returns null whenever any of its arguments are null. If this parameter is specified, the function is not executed when there are null arguments; instead a null result is assumed automatically.
Execute with definer's privileges
This option specifies that the function is to be executed with the privileges of the user that created it. Otherwise, the function is to be executed with the privileges of the user that calls it.
Is window function
This option indicates that the function is a window function rather than a plain function. A window function performs a calculation across a set of table rows that are somehow related to the current row.
Is leakproof function
This option indicates that the function has no side effects. It reveals no information about its arguments other than by its return value. For example, a function which throws an error message for some argument values but not others, or which includes the argument values in any error message, is not leakproof.
Select the behaviour of the function:
IMMUTABLE indicates that the function cannot modify the database and always returns the same result when given the same argument values.
STABLE indicates that the function cannot modify the database, and that within a single table scan it will consistently return the same result for the same argument values, but that its result could change across SQL statements.
VOLATILE indicates that the function value can change even within a single table scan, so no optimizations can be made.
Set whether the function can be executed in the parallel mode:
UNSAFE value prohibits parallel mode.
RESTRICTED indicates that the function can be executed in parallel mode, but the execution is restricted to parallel group leader.
SAFE value indicates that the function can be run in parallel mode.
This group is available for server version 8.3 and higher. The spinner controls allow you to specify Estimated execution cost and Estimated number of rows.
This area allows you to set the function definition (body).
For your convenience the syntax highlight, code folding, using macro and a number of other features for efficient SQL editing are implemented. For details see Working with Query Data area, Using the context menu and .
The possibility to use macros is also implemented.
To start recording a macro, click the Record button available in the status bar area, or use the Shift+Ctrl+R shortcut.
To stop recording, click the Stop button, or use the Shift+Ctrl+R shortcut.
To call the recorded macro, use the Play button, or use the Shift+Ctrl+P shortcut.