summaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/create_function.sgml
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-10-08 02:39:25 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-10-08 02:39:25 +0000
commit717fa274d14d9cd25396b85bb92f567e1c623f0c (patch)
tree4fe298a9faa1fc8f038a9a1f35ee033abc3e41ed /doc/src/sgml/ref/create_function.sgml
parent2eda8dfb52ed9962920282d8384da8bb4c22514d (diff)
Support use of function argument names to identify which actual arguments
match which function parameters. The syntax uses AS, for example funcname(value AS arg1, anothervalue AS arg2) Pavel Stehule
Diffstat (limited to 'doc/src/sgml/ref/create_function.sgml')
-rw-r--r--doc/src/sgml/ref/create_function.sgml23
1 files changed, 19 insertions, 4 deletions
diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml
index 0843a175638..6d7eb84d8f2 100644
--- a/doc/src/sgml/ref/create_function.sgml
+++ b/doc/src/sgml/ref/create_function.sgml
@@ -1,5 +1,5 @@
<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/create_function.sgml,v 1.87 2009/10/02 18:13:04 tgl Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/create_function.sgml,v 1.88 2009/10/08 02:39:14 tgl Exp $
-->
<refentry id="SQL-CREATEFUNCTION">
@@ -65,7 +65,7 @@ CREATE [ OR REPLACE ] FUNCTION
Also, <command>CREATE OR REPLACE FUNCTION</command> will not let
you change the return type of an existing function. To do that,
you must drop and recreate the function. (When using <literal>OUT</>
- parameters, that means you cannot change the names or types of any
+ parameters, that means you cannot change the types of any
<literal>OUT</> parameters except by dropping the function.)
</para>
@@ -121,8 +121,11 @@ CREATE [ OR REPLACE ] FUNCTION
<para>
The name of an argument. Some languages (currently only PL/pgSQL) let
you use the name in the function body. For other languages the
- name of an input argument is just extra documentation. But the name
- of an output argument is significant, since it defines the column
+ name of an input argument is just extra documentation, so far as
+ the function itself is concerned; but you can use input argument names
+ when calling a function to improve readability (see <xref
+ linkend="sql-syntax-calling-funcs">). In any case, the name
+ of an output argument is significant, because it defines the column
name in the result row type. (If you omit the name for an output
argument, the system will choose a default column name.)
</para>
@@ -570,6 +573,18 @@ CREATE FUNCTION foo(int, int default 42) ...
to replace it (this includes being a member of the owning role).
</para>
+ <para>
+ When replacing an existing function with <command>CREATE OR REPLACE
+ FUNCTION</>, there are restrictions on changing parameter names.
+ You cannot change the name already assigned to any input parameter
+ (although you can add names to parameters that had none before).
+ If there is more than one output parameter, you cannot change the
+ names of the output parameters, because that would change the
+ column names of the anonymous composite type that describes the
+ function's result. These restrictions are made to ensure that
+ existing calls of the function do not stop working when it is replaced.
+ </para>
+
</refsect1>
<refsect1 id="sql-createfunction-examples">