mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
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
This commit is contained in:
@ -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">
|
||||
|
Reference in New Issue
Block a user