From: | Erwin Brandstetter <brandstetter(at)falter(dot)at> |
---|---|
To: | pgsql-docs(at)postgresql(dot)org |
Subject: | Reference function arguments by name |
Date: | 2013-05-09 20:46:35 |
Message-ID: | 518C0B2B.9040909@falter.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
Hi!
The manual says here:
http://www.postgresql.org/docs/current/interactive/sql-createfunction.html
http://www.postgresql.org/docs/devel/static/sql-createfunction.html
> argname
>
> 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, so far as
> the function itself is concerned; but you can use input argument
> names when calling a function to improve readability (see Section
> 4.3
> <http://www.postgresql.org/docs/current/interactive/sql-syntax-calling-funcs.html>).
> 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.)
>
This has changed in version 9.2. SQL functions can reference the name. Ergo:
s /(currently only PL/pgSQL) / (currently only PL/pgSQL and SQL)
I tested it and it's /correctly /documented here:
http://www.postgresql.org/docs/current/interactive/xfunc-sql.html#XFUNC-SQL-FUNCTION-ARGUMENTS
> Arguments of a SQL function can be referenced in the function body
using either names or numbers.
Regards
Erwin
From | Date | Subject | |
---|---|---|---|
Next Message | Sian Mountbatten | 2013-05-11 08:13:32 | Re: Reference function arguments by name |
Previous Message | Miles Elam | 2013-05-07 22:47:43 | Re: pgcrypto docs |