1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ALTER ROUTINE</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-alterrole.html" title="ALTER ROLE" /><link rel="next" href="sql-alterrule.html" title="ALTER RULE" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">ALTER ROUTINE</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-alterrole.html" title="ALTER ROLE">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-alterrule.html" title="ALTER RULE">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-ALTERROUTINE"><div class="titlepage"></div><a id="id-1.9.3.27.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">ALTER ROUTINE</span></h2><p>ALTER ROUTINE — change the definition of a routine</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
ALTER ROUTINE <em class="replaceable"><code>name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ]
<em class="replaceable"><code>action</code></em> [ ... ] [ RESTRICT ]
ALTER ROUTINE <em class="replaceable"><code>name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ]
RENAME TO <em class="replaceable"><code>new_name</code></em>
ALTER ROUTINE <em class="replaceable"><code>name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ]
OWNER TO { <em class="replaceable"><code>new_owner</code></em> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER ROUTINE <em class="replaceable"><code>name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ]
SET SCHEMA <em class="replaceable"><code>new_schema</code></em>
ALTER ROUTINE <em class="replaceable"><code>name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ]
[ NO ] DEPENDS ON EXTENSION <em class="replaceable"><code>extension_name</code></em>
<span class="phrase">where <em class="replaceable"><code>action</code></em> is one of:</span>
IMMUTABLE | STABLE | VOLATILE
[ NOT ] LEAKPROOF
[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
PARALLEL { UNSAFE | RESTRICTED | SAFE }
COST <em class="replaceable"><code>execution_cost</code></em>
ROWS <em class="replaceable"><code>result_rows</code></em>
SET <em class="replaceable"><code>configuration_parameter</code></em> { TO | = } { <em class="replaceable"><code>value</code></em> | DEFAULT }
SET <em class="replaceable"><code>configuration_parameter</code></em> FROM CURRENT
RESET <em class="replaceable"><code>configuration_parameter</code></em>
RESET ALL
</pre></div><div class="refsect1" id="id-1.9.3.27.5"><h2>Description</h2><p>
<code class="command">ALTER ROUTINE</code> changes the definition of a routine, which
can be an aggregate function, a normal function, or a procedure. See
under <a class="xref" href="sql-alteraggregate.html" title="ALTER AGGREGATE"><span class="refentrytitle">ALTER AGGREGATE</span></a>, <a class="xref" href="sql-alterfunction.html" title="ALTER FUNCTION"><span class="refentrytitle">ALTER FUNCTION</span></a>,
and <a class="xref" href="sql-alterprocedure.html" title="ALTER PROCEDURE"><span class="refentrytitle">ALTER PROCEDURE</span></a> for the description of the
parameters, more examples, and further details.
</p></div><div class="refsect1" id="id-1.9.3.27.6"><h2>Examples</h2><p>
To rename the routine <code class="literal">foo</code> for type
<code class="type">integer</code> to <code class="literal">foobar</code>:
</p><pre class="programlisting">
ALTER ROUTINE foo(integer) RENAME TO foobar;
</pre><p>
This command will work independent of whether <code class="literal">foo</code> is an
aggregate, function, or procedure.
</p></div><div class="refsect1" id="id-1.9.3.27.7"><h2>Compatibility</h2><p>
This statement is partially compatible with the <code class="command">ALTER
ROUTINE</code> statement in the SQL standard. See
under <a class="xref" href="sql-alterfunction.html" title="ALTER FUNCTION"><span class="refentrytitle">ALTER FUNCTION</span></a>
and <a class="xref" href="sql-alterprocedure.html" title="ALTER PROCEDURE"><span class="refentrytitle">ALTER PROCEDURE</span></a> for more details. Allowing
routine names to refer to aggregate functions is
a <span class="productname">PostgreSQL</span> extension.
</p></div><div class="refsect1" id="id-1.9.3.27.8"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-alteraggregate.html" title="ALTER AGGREGATE"><span class="refentrytitle">ALTER AGGREGATE</span></a>, <a class="xref" href="sql-alterfunction.html" title="ALTER FUNCTION"><span class="refentrytitle">ALTER FUNCTION</span></a>, <a class="xref" href="sql-alterprocedure.html" title="ALTER PROCEDURE"><span class="refentrytitle">ALTER PROCEDURE</span></a>, <a class="xref" href="sql-droproutine.html" title="DROP ROUTINE"><span class="refentrytitle">DROP ROUTINE</span></a></span><p>
Note that there is no <code class="literal">CREATE ROUTINE</code> command.
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-alterrole.html" title="ALTER ROLE">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-alterrule.html" title="ALTER RULE">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ALTER ROLE </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="40%" align="right" valign="top"> ALTER RULE</td></tr></table></div></body></html>
|