Skip to content

Procedure

Defines a procedure (CREATE PROCEDURE), which CALL invokes and which returns no value

Properties

Property Type Required Description
schema string yes The schema the procedure is created in.
name string yes The procedure name.
owner string — The role that owns the procedure.
sql string — User-provided raw SQL snippet.
parameters array of object — An array of IN, OUT, BOTH, VARADIC, and TABLE args.
language string — The name of the language that the procedure is implemented in. It can be sql, c, internal, or the name of a user-defined procedural language, e.g. plpgsql.
transform_types array of string — Lists which transforms a call to the procedure should apply.
security INVOKER | DEFINER — INVOKER indicates that the procedure is to be executed with the privileges of the user that calls it. That is the default. DEFINER specifies that the function is to be executed with the privileges of the user that owns it.
configuration object — Configuration parameters to be set to the specified value when the procedure is entered, and then restored to its prior value when the procedure exits. A value is a string, a number or a boolean. A setting that PostgreSQL keeps as a list of names, such as search_path, is a list of strings, one name for each item. For such a setting, one string with a comma is an error, because PostgreSQL reads it as one name. A list has at least one item.
definition string — A string constant defining the procedure; the meaning depends on the language. It can be an internal procedure name, the path to an object file, an SQL command, or text in a procedural language.
sql_body string — A body written in SQL-standard form, BEGIN ATOMIC ... END, in place of definition; the statements are parsed when the procedure is created.
object_file string — Used for dynamically loadable C language functions when the procedure name in the C language source code is not the same as the name of the SQL function.
link_symbol string — The string link_symbol is the procedure's link symbol when used in conjunction with object_file, that is, the name of the procedure in the C language source code. If the link symbol is omitted, it is assumed to be the same as the name of the SQL function being defined. The C names of all functions must be different, so you must give overloaded C functions different C names (for example, use the argument types as part of the C names).
comment string — An optional comment about the procedure.
security_labels security_labels — Security Labels.
dependencies dependencies — Database objects this object is dependent upon.

parameters[]

Property Type Required Description
mode IN | OUT | INOUT | VARIADIC | TABLE yes Parameter Mode.
name string — Parameter Name.
data_type string yes Parameter Data Type.
default boolean | null | number | string — Default value for Paramter.

Mutually exclusive forms

Exactly one of these must hold:

  • language and definition
  • language and sql_body
  • language and object_file
  • sql

No other properties are accepted.


Source: schemata/procedure.yml · Resolved JSON Schema: procedure.json