3.26. Procedures

Procedures are almost like ordinary functions except for the fact that they can commit or roll back transactions during their execution, and 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, instead, they must be called in isolation using the CALL command. The attributes of procedures are defined below:

Attribute Description
Language 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's also possible to use user-defined languages in the procedure's definition.
Security This attribute indicates the security of a procedure when called. Two values are accepted: SECURITY INVOKER and SECURITY DEFINER. The first one indicates that the procedure should be executed with the privileges of the caller user. The second value indicates that the procedure should be called with the definer's privileges.
Parameters This tab is used to configure all parameters available for the procedure. Procedure parameters are the very same as the ones used in functions. So, refer to the function's documentation page for details about this kind of object.
Transform types This tab lists which transform objects a call to the procedure should apply.
Definition This tab is used to configure the procedure's core definition. The fields visible in this tab may vary according to the language selected. For c language two fields will be visible: Symbol and Library. For any other language, the field Source Code will be visible.
Symbol The symbol (function name) that defines the procedure in a shared library. Details about the symbol and C-based procedure can be seen in PostgreSQL documentation.
Library The shared library file where the procedure code can be found. The value used here must be the path to the shared object file on the destination server where the procedure will be created.
Source 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 other than the one defined in the field Language.
Configuration This tab is used to define runtime configuration parameters for the functions through SET configuration_parameter = value.

Jun 14, 2023 at 10:52