~ubuntu-branches/debian/squeeze/pgadmin3/squeeze

« back to all changes in this revision

Viewing changes to docs/en_US/pg/sql-alterfunction.html

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Porcheron
  • Date: 2008-02-07 00:56:22 UTC
  • mto: (2.1.6 hardy) (6.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080207005622-c2ail8p4d0sk3dnw
Tags: upstream-1.8.2
ImportĀ upstreamĀ versionĀ 1.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<html>
2
 
<head>
3
 
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4
 
<title>ALTER FUNCTION</title>
5
 
<link rel="stylesheet" href="stylesheet.css" type="text/css">
6
 
<link rev="made" href="pgsql-docs@postgresql.org">
7
 
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
8
 
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
9
 
<link rel="up" href="sql-commands.html" title="SQL Commands">
10
 
<link rel="prev" href="sql-alterdomain.html" title="ALTER DOMAIN">
11
 
<link rel="next" href="sql-altergroup.html" title="ALTER GROUP">
12
 
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
13
 
</head>
14
 
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
15
 
<a name="sql-alterfunction"></a><div class="titlepage"></div>
16
 
<div class="refnamediv">
17
 
<h2>Name</h2>
18
 
<p>ALTER FUNCTION &#8212; change the definition of a function</p>
19
 
</div>
20
 
<a name="id741990"></a><div class="refsynopsisdiv">
21
 
<h2>Synopsis</h2>
22
 
<pre class="synopsis">ALTER FUNCTION <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> [, ...] ] )
23
 
    <em class="replaceable"><code>action</code></em> [, ... ] [ RESTRICT ]
24
 
ALTER FUNCTION <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> [, ...] ] )
25
 
    RENAME TO <em class="replaceable"><code>new_name</code></em>
26
 
ALTER FUNCTION <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> [, ...] ] )
27
 
    OWNER TO <em class="replaceable"><code>new_owner</code></em>
28
 
ALTER FUNCTION <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> [, ...] ] )
29
 
    SET SCHEMA <em class="replaceable"><code>new_schema</code></em>
30
 
 
31
 
where <em class="replaceable"><code>action</code></em> is one of:
32
 
 
33
 
    CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
34
 
    IMMUTABLE | STABLE | VOLATILE
35
 
    [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER</pre>
36
 
</div>
37
 
<div class="refsect1" lang="en">
38
 
<a name="id742135"></a><h2>Description</h2>
39
 
<p>   <code class="command">ALTER FUNCTION</code> changes the definition of a
40
 
   function.
41
 
  </p>
42
 
<p>   You must own the function to use <code class="command">ALTER FUNCTION</code>.
43
 
   To change a function's schema, you must also have <code class="literal">CREATE</code>
44
 
   privilege on the new schema.
45
 
   To alter the owner, you must also be a direct or indirect member of the new
46
 
   owning role, and that role must have <code class="literal">CREATE</code> privilege on
47
 
   the function's schema.  (These restrictions enforce that altering the owner
48
 
   doesn't do anything you couldn't do by dropping and recreating the function.
49
 
   However, a superuser can alter ownership of any function anyway.)
50
 
  </p>
51
 
</div>
52
 
<div class="refsect1" lang="en">
53
 
<a name="id742179"></a><h2>Parameters</h2>
54
 
<div class="variablelist"><dl>
55
 
<dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt>
56
 
<dd><p>      The name (optionally schema-qualified) of an existing function.
57
 
     </p></dd>
58
 
<dt><span class="term"><em class="replaceable"><code>argmode</code></em></span></dt>
59
 
<dd><p>      The mode of an argument: either <code class="literal">IN</code>, <code class="literal">OUT</code>,
60
 
      or <code class="literal">INOUT</code>.  If omitted, the default is <code class="literal">IN</code>.
61
 
      Note that <code class="command">ALTER FUNCTION</code> does not actually pay
62
 
      any attention to <code class="literal">OUT</code> arguments, since only the input
63
 
      arguments are needed to determine the function's identity.
64
 
      So it is sufficient to list the <code class="literal">IN</code> and <code class="literal">INOUT</code>
65
 
      arguments.
66
 
     </p></dd>
67
 
<dt><span class="term"><em class="replaceable"><code>argname</code></em></span></dt>
68
 
<dd><p>      The name of an argument.
69
 
      Note that <code class="command">ALTER FUNCTION</code> does not actually pay
70
 
      any attention to argument names, since only the argument data
71
 
      types are needed to determine the function's identity.
72
 
     </p></dd>
73
 
<dt><span class="term"><em class="replaceable"><code>argtype</code></em></span></dt>
74
 
<dd><p>      The data type(s) of the function's arguments (optionally 
75
 
      schema-qualified), if any.
76
 
     </p></dd>
77
 
<dt><span class="term"><em class="replaceable"><code>new_name</code></em></span></dt>
78
 
<dd><p>      The new name of the function.
79
 
     </p></dd>
80
 
<dt><span class="term"><em class="replaceable"><code>new_owner</code></em></span></dt>
81
 
<dd><p>      The new owner of the function.  Note that if the function is
82
 
      marked <code class="literal">SECURITY DEFINER</code>, it will subsequently
83
 
      execute as the new owner.
84
 
     </p></dd>
85
 
<dt><span class="term"><em class="replaceable"><code>new_schema</code></em></span></dt>
86
 
<dd><p>      The new schema for the function.
87
 
     </p></dd>
88
 
<dt>
89
 
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="literal">CALLED ON NULL INPUT</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="literal">RETURNS NULL ON NULL INPUT</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="literal">STRICT</code></span>
90
 
</dt>
91
 
<dd><p>       <code class="literal">CALLED ON NULL INPUT</code> changes the function so
92
 
       that it will be invoked when some or all of its arguments are
93
 
       null. <code class="literal">RETURNS NULL ON NULL INPUT</code> or
94
 
       <code class="literal">STRICT</code> changes the function so that it is not
95
 
       invoked if any of its arguments are null; instead, a null result
96
 
       is assumed automatically.  See <a href="sql-createfunction.html" title="CREATE FUNCTION"><span class="refentrytitle"><a name="sql-createfunction-title"></a>CREATE FUNCTION</span></a> for more information.
97
 
      </p></dd>
98
 
<dt>
99
 
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="literal">IMMUTABLE</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="literal">STABLE</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="literal">VOLATILE</code></span>
100
 
</dt>
101
 
<dd><p>       Change the volatility of the function to the specified
102
 
       setting.  See <a href="sql-createfunction.html" title="CREATE FUNCTION"><span class="refentrytitle"><a name="sql-createfunction-title"></a>CREATE FUNCTION</span></a> for details.
103
 
      </p></dd>
104
 
<dt>
105
 
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="literal">[<span class="optional"> EXTERNAL </span>] SECURITY INVOKER</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="literal">[<span class="optional"> EXTERNAL </span>] SECURITY DEFINER</code></span>
106
 
</dt>
107
 
<dd><p>      Change whether the function is a security definer or not. The
108
 
      key word <code class="literal">EXTERNAL</code> is ignored for SQL
109
 
      conformance. See <a href="sql-createfunction.html" title="CREATE FUNCTION"><span class="refentrytitle"><a name="sql-createfunction-title"></a>CREATE FUNCTION</span></a> for more
110
 
      information about this capability.
111
 
     </p></dd>
112
 
<dt><span class="term"><code class="literal">RESTRICT</code></span></dt>
113
 
<dd><p>      Ignored for conformance with the SQL standard.
114
 
     </p></dd>
115
 
</dl></div>
116
 
</div>
117
 
<div class="refsect1" lang="en">
118
 
<a name="id742485"></a><h2>Examples</h2>
119
 
<p>   To rename the function <code class="literal">sqrt</code> for type
120
 
   <code class="type">integer</code> to <code class="literal">square_root</code>:
121
 
</p>
122
 
<pre class="programlisting">ALTER FUNCTION sqrt(integer) RENAME TO square_root;</pre>
123
 
<p>
124
 
  </p>
125
 
<p>   To change the owner of the function <code class="literal">sqrt</code> for type
126
 
   <code class="type">integer</code> to <code class="literal">joe</code>:
127
 
</p>
128
 
<pre class="programlisting">ALTER FUNCTION sqrt(integer) OWNER TO joe;</pre>
129
 
<p>
130
 
  </p>
131
 
<p>   To change the schema of the function <code class="literal">sqrt</code> for type
132
 
   <code class="type">integer</code> to <code class="literal">maths</code>:
133
 
</p>
134
 
<pre class="programlisting">ALTER FUNCTION sqrt(integer) SET SCHEMA maths;</pre>
135
 
<p>
136
 
  </p>
137
 
</div>
138
 
<div class="refsect1" lang="en">
139
 
<a name="id742571"></a><h2>Compatibility</h2>
140
 
<p>   This statement is partially compatible with the <code class="command">ALTER
141
 
   FUNCTION</code> statement in the SQL standard. The standard allows more
142
 
   properties of a function to be modified, but does not provide the
143
 
   ability to rename a function, make a function a security definer,
144
 
   or change the owner, schema, or volatility of a function. The standard also
145
 
   requires the <code class="literal">RESTRICT</code> key word, which is optional in
146
 
   <span class="productname">PostgreSQL</span>.
147
 
  </p>
148
 
</div>
149
 
<div class="refsect1" lang="en">
150
 
<a name="id742604"></a><h2>See Also</h2>
151
 
<span class="simplelist"><a href="sql-createfunction.html">CREATE FUNCTION</a>, <a href="sql-dropfunction.html">DROP FUNCTION</a></span>
152
 
</div>
153
 
</div></body>
154
 
</html>