From 455dffbb73f9875c39f2ab544420454168a8c68c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 4 Dec 2008 17:51:28 +0000 Subject: Default values for function arguments Pavel Stehule, with some tweaks by Peter Eisentraut --- doc/src/sgml/ref/create_function.sgml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'doc/src/sgml/ref/create_function.sgml') diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index a6af57a22bf..5de4967789d 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -1,5 +1,5 @@ @@ -21,7 +21,7 @@ $PostgreSQL: pgsql/doc/src/sgml/ref/create_function.sgml,v 1.81 2008/11/14 10:22 CREATE [ OR REPLACE ] FUNCTION - name ( [ [ argmode ] [ argname ] argtype [, ...] ] ) + name ( [ [ argmode ] [ argname ] argtype [ { DEFAULT | = } defexpr] [, ...] ] ) [ RETURNS rettype | RETURNS TABLE ( colname coltype [, ...] ) ] { LANGUAGE langname @@ -154,6 +154,20 @@ CREATE [ OR REPLACE ] FUNCTION + + defexpr + + + + An expression to be used as default value if the parameter is + not specified. The expression has to be convertable to the + argument type of the parameter. All parameters after a + parameter with default value have to be parameters with default + values as well. + + + + rettype @@ -667,6 +681,14 @@ COMMIT; either before or after argname. But only the first way is standard-compliant. + + + The SQL standard does not specify parameter defaults. The syntax + with the DEFAULT key word is from Oracle, and it + is somewhat in the spirit of the standard: SQL/PSM uses it for + variable default values. The syntax with = is + used in T-SQL and Firebird. + -- cgit v1.2.3