From: Erwin Brandstetter <brandstetter@falter.at>
To: Sian Mountbatten <poenikatu@fastmail.co.uk>
Cc: pgsql-docs@postgresql.org
Subject: Re: Reference function arguments by name
Date: Sat, 11 May 2013 10:20:14 +0200
Message-ID: <518DFF3E.90701@falter.at> (raw)
In-Reply-To: <518DFDAC.2060909@fastmail.co.uk>
References: <518C0B2B.9040909@falter.at>
<518DFDAC.2060909@fastmail.co.uk>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-docs>
On 11.05.2013 10:13, Sian Mountbatten wrote:
> On 2013-05-09 21:46, Erwin Brandstetter wrote:
>> 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
> It looks strongly that you people are of the opinion that "the code
> documents
> itself". That is a myth produced by lazy software developers who
> cannot document
> their code properly. You ought to be using Cweb for C code. Have a look at
> the code for SQLite to see how comments in C can be used to provide decent
> documentation
>
> Fortunately, I do not use C. I prefer a HIGH-level language :-)
This reply seems unrelated.
Regards
Erwin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: brandstetter@falter.at, poenikatu@fastmail.co.uk
Subject: Re: Reference function arguments by name
In-Reply-To: <518DFF3E.90701@falter.at>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox