3.26. Procedures

Procedures are almost like ordinary functions except for the fact that they can run in a transaction block 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.
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 on 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 on the field Language.

Mar 12, 2021 at 10:37