mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Allow ALTER FUNCTION to change a function's strictness, volatility, and
whether or not it is a security definer. Changing a function's strictness is required by SQL2003, and the other capabilities make sense. Also, allow an optional RESTRICT noise word to be specified, for SQL conformance. Some trivial regression tests added and the documentation has been updated.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.5 2004/06/25 21:55:50 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_function.sgml,v 1.6 2005/03/14 00:19:36 neilc Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -20,8 +20,15 @@ PostgreSQL documentation
|
||||
|
||||
<refsynopsisdiv>
|
||||
<synopsis>
|
||||
ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) <replaceable class="PARAMETER">action</replaceable> [, ... ] [ RESTRICT ]
|
||||
ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) RENAME TO <replaceable>newname</replaceable>
|
||||
ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] ) OWNER TO <replaceable>newowner</replaceable>
|
||||
|
||||
where <replaceable class="PARAMETER">action</replaceable> is one of:
|
||||
|
||||
CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
|
||||
IMMUTABLE | STABLE | VOLATILE
|
||||
[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@ -69,11 +76,65 @@ ALTER FUNCTION <replaceable>name</replaceable> ( [ <replaceable class="parameter
|
||||
<term><replaceable class="parameter">newowner</replaceable></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The new owner of the function.
|
||||
To change the owner of a function, you must be a superuser.
|
||||
Note that if the function is marked
|
||||
<literal>SECURITY DEFINER</literal>,
|
||||
it will subsequently execute as the new owner.
|
||||
The new owner of the function. To change the owner of a
|
||||
function, you must be a superuser. Note that if the function is
|
||||
marked <literal>SECURITY DEFINER</literal>, it will subsequently
|
||||
execute as the new owner.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CALLED ON NULL INPUT</literal></term>
|
||||
<term><literal>RETURNS NULL ON NULL INPUT</literal></term>
|
||||
<term><literal>STRICT</literal></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>CALLED ON NULL INPUT</literal> changes the function so
|
||||
that it will be invoked when some or all of its arguments are
|
||||
null. <literal>RETURNS NULL ON NULL INPUT</literal> or
|
||||
<literal>STRICT</literal> changes the function so that it
|
||||
always returns null if any of its arguments are null. See <xref
|
||||
linkend="sql-createfunction"> for more information.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>IMMUTABLE</literal></term>
|
||||
<term><literal>STABLE</literal></term>
|
||||
<term><literal>VOLATILE</literal></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Change the volatility of the function to the specified
|
||||
type. See <xref linkend="sql-createfunction"> for more
|
||||
information about function volatility.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal><optional>EXTERNAL</optional> SECURITY INVOKER</literal></term>
|
||||
<term><literal><optional>EXTERNAL</optional> SECURITY DEFINER</literal></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Change whether the function is a security definer or not. The
|
||||
key word <literal>EXTERNAL</literal> is ignored for SQL
|
||||
conformance. See <xref linkend="sql-createfunction"> for more
|
||||
information about this capability.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>RESTRICT</literal></term>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
Ignored for conformance with the SQL standard.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@ -104,9 +165,13 @@ ALTER FUNCTION sqrt(integer) OWNER TO joe;
|
||||
<title>Compatibility</title>
|
||||
|
||||
<para>
|
||||
There is an <command>ALTER FUNCTION</command> statement in the SQL
|
||||
standard, but it does not provide the option to rename the
|
||||
function or change the owner.
|
||||
This statement is partially compatible with the <command>ALTER
|
||||
FUNCTION</> statement in the SQL standard. The standard allows more
|
||||
properties of a function to be modified, but does not provide the
|
||||
ability to rename a function, make a function a security definer,
|
||||
or change the owner or volatility of a function. The standard also
|
||||
requires the <literal>RESTRICT</> key word; it is optional in
|
||||
<productname>PostgreSQL</>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
Reference in New Issue
Block a user