procedure, then
the effects of a <command>SET LOCAL</command> command executed inside the
procedure for the same variable are restricted to the procedure: the
configuration parameter's prior value is still restored at procedure exit.
However, an ordinary
<command>SET</command> command (without <literal>LOCAL</literal>) overrides the
<literal>SET</literal> clause, much as it would do for a previous <command>SET
LOCAL</command> command: the effects of such a command will persist after
procedure exit, unless the current transaction is rolled back.
</para>
<para>
If a <literal>SET</literal> clause is attached to a procedure, then
that procedure cannot execute transaction control statements (for
example, <command>COMMIT</command> and <command>ROLLBACK</command>,
depending on the language).
</para>
<para>
See <xref linkend="sql-set"/> and
<xref linkend="runtime-config"/>
for more information about allowed parameter names and values.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">definition</replaceable></term>
<listitem>
<para>
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.
</para>
<para>
It is often helpful to use dollar quoting (see <xref
linkend="sql-syntax-dollar-quoting"/>) to write the procedure definition
string, rather than the normal single quote syntax. Without dollar
quoting, any single quotes or backslashes in the procedure definition must
be escaped by doubling them.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal><replaceable class="parameter">obj_file</replaceable>, <replaceable class="parameter">link_symbol</replaceable></literal></term>
<listitem>
<para>
This form of the <literal>AS</literal> clause is used for
dynamically loadable C language procedures when the procedure name
in the C language source code is not the same as the name of
the SQL procedure. The string <replaceable
class="parameter">obj_file</replaceable> is the name of the shared
library file containing the compiled C procedure, and is interpreted
as for the <link linkend="sql-load"><command>LOAD</command></link> command. The string
<replaceable class="parameter">link_symbol</replaceable> is the
procedure's link symbol, 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 procedure being defined.
</para>
<para>
When repeated <command>CREATE PROCEDURE</command> calls refer to
the same object file, the file is only loaded once per session.
To unload and