Skip to main content
Version: 2.0.0 (latest)

3.26. Procedures

Procedures are almost like ordinary functions except for the fact that they can't return values as functions do. There are other essential differences; for instance, procedures can't be called as part of a DML command and must be called in isolation using the CALL command. The attributes of procedures are defined below:

ch3.procedure-dialog.general12

General
#FieldDescription
1Language

The language in which the procedure is written. There are four built-in languages available when a new model is created in pgModeler: c, internal, sql, and plpgsql. It is also possible to use the user-defined languages of the model.

2Security

Indicates the security context in which the procedure is executed. Two values are accepted: SECURITY INVOKER and SECURITY DEFINER. The first one indicates that the procedure is executed with the privileges of the user that calls it. The second one indicates that the procedure is executed with the privileges of the user that owns (defined) it.

ch3.procedure-dialog.parameters1

Parameters
#FieldDescription
1Parameters

The parameters of the routine (name, type, mode, and default value). Use the buttons beside the list ( ) to handle them. The parameter form is the same used by functions.

ch3.procedure-dialog.transform-types1234

Transform types
#FieldGroup boxDescription
1TypeData type

The data type. Besides the built-in types, the list also holds the user-defined types, domains and other types of the model.

2DimensionData type

Number of dimensions when the type is an array (type[]). 0 means that the type is not an array.

3FormatData type

Read-only preview of the data type as it is written in the SQL code, with length, precision, dimension and other modifiers applied.

4Transform types

The transforms that a call to the routine should apply. Select the type in the group above and use the add button to include it in the list.

ch3.procedure-dialog.definition1

Definition
#FieldDescription
1Source code

The complete set of commands that the procedure must execute. This field is language-dependent, which means that you cannot mix commands from different languages: only the language selected in the field Language can be used. When the language is c, this field is replaced by the fields Library and Symbol.

ch3.procedure-dialog.configuration1

Configuration
#FieldDescription
1Configuration parameters

Runtime configuration parameters of the routine (SET configuration_parameter = value). Type the parameter and the value, then use the add button to include them in the list.

The fields of the tab Definition vary according to the selected language. For the c language, the fields Symbol (the function name that defines the procedure in a shared library) and Library (the path to the shared object file on the destination server) are shown instead of the source code. For any other language, the source code field is shown; it is language-dependent, so commands of different languages can't be mixed.

References​

Procedure DDL
https://www.postgresql.org/docs/current/static/sql-createprocedure.html

Procedure details
https://www.postgresql.org/docs/current/static/xproc.html