Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/alter_routine.sgml`
946426631ffa7a24aa61ed2496b1eaa2717f5989908d338c0000000100000c8f
 class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
    OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
    SET SCHEMA <replaceable>new_schema</replaceable>
ALTER ROUTINE <replaceable>name</replaceable> [ ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) ]
    [ NO ] DEPENDS ON EXTENSION <replaceable>extension_name</replaceable>

<phrase>where <replaceable class="parameter">action</replaceable> is one of:</phrase>

    IMMUTABLE | STABLE | VOLATILE
    [ NOT ] LEAKPROOF
    [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
    PARALLEL { UNSAFE | RESTRICTED | SAFE }
    COST <replaceable class="parameter">execution_cost</replaceable>
    ROWS <replaceable class="parameter">result_rows</replaceable>
    SET <replaceable class="parameter">configuration_parameter</replaceable> { TO | = } { <replaceable class="parameter">value</replaceable> | DEFAULT }
    SET <replaceable class="parameter">configuration_parameter</replaceable> FROM CURRENT
    RESET <replaceable class="parameter">configuration_parameter</replaceable>
    RESET ALL
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>ALTER ROUTINE</command> changes the definition of a routine, which
   can be an aggregate function, a normal function, or a procedure.  See
   under <xref linkend="sql-alteraggregate"/>, <xref linkend="sql-alterfunction"/>,
   and <xref linkend="sql-alterprocedure"/> for the description of the
   parameters, more examples, and further details.
  </para>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   To rename the routine <literal>foo</literal> for type
   <type>integer</type> to <literal>foobar</literal>:
<programlisting>
ALTER ROUTINE foo(integer) RENAME TO foobar;
</programlisting>
   This command will work independent of whether <literal>foo</literal> is an
   aggregate, function, or procedure.
  </para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   This statement is partially compatible with the <command>ALTER
   ROUTINE</command> statement in the SQL standard.  See
   under <xref linkend="sql-alterfunction"/>
   and <xref linkend="sql-alterprocedure"/> for more details.  Allowing
   routine names to refer to aggregate functions is
   a <productname>PostgreSQL</productname> extension.
  </para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-alteraggregate"/></member>
   <member><xref linkend="sql-alterfunction"/></member>
   <member><xref linkend="sql-alterprocedure"/></member>
   <member><xref linkend="sql-droproutine"/></member>
  </simplelist>

  <para>
   Note that there is no <literal>CREATE ROUTINE</literal> command.
  </para>
 </refsect1>
</refentry>

Title: ALTER ROUTINE: Details, Examples, and Compatibility
Summary
This section provides further details on the ALTER ROUTINE command in PostgreSQL, including the specific actions that can be performed. It describes options such as setting volatility, leakproof status, security invoker/definer, parallel execution, cost, rows, and configuration parameters. It also includes an example of renaming a routine and discusses the command's compatibility with the SQL standard, noting PostgreSQL extensions. Finally, it provides links to related commands like ALTER AGGREGATE, ALTER FUNCTION, ALTER PROCEDURE, and DROP ROUTINE.