Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ub4qE-0001CH-Hi for pgsql-docs@arkaria.postgresql.org; Sat, 11 May 2013 08:07:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Ub4qD-0001nT-Qu for pgsql-docs@arkaria.postgresql.org; Sat, 11 May 2013 08:07:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UaXiv-0000KB-AK for pgsql-docs@postgresql.org; Thu, 09 May 2013 20:45:57 +0000 Received: from mail-ee0-f53.google.com ([74.125.83.53]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UaXiq-0007lp-CB for pgsql-docs@postgresql.org; Thu, 09 May 2013 20:45:56 +0000 Received: by mail-ee0-f53.google.com with SMTP id d49so1826291eek.12 for ; Thu, 09 May 2013 13:45:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :content-type:x-gm-message-state; bh=o8xUndfK04VMv8VN37Mupl3vUKHLBXgMTKU6PeL5M2A=; b=Ca2a6jYl5TrM/mBa30yL8jLpDCdc+v8qa/mN7eWZVwc4k7TD0IdrmQAH6v4HglkH1h Z8Plj4e06PeZyNojvIVWfzIfGFiqkT3HAwtxQAKAcT0zrMWwW1yFGrkr7omMSaWUbAL4 7GTnwSQcEA9/KSAnrteukgqx9hnxG9xI1kOnNFjyRXns4G3+S+s0f535DdIDvITgownh pC5kUPEu67SK8ggoJ4yCcydzBVtNFN5t0HJ5Jm5dsd68t2ohoP6WtyOcE7hKJWvsgm+1 vj5EkuSXxNwY2Uyk3xZVjLtkg83A8+JAPYocdjXeGzkQyoFelokSxwf9JwV+qPStacRO 2TgQ== X-Received: by 10.14.203.73 with SMTP id e49mr33114959eeo.20.1368132351670; Thu, 09 May 2013 13:45:51 -0700 (PDT) Received: from [192.168.2.100] (chello080109013165.10.14.univie.teleweb.at. [80.109.13.165]) by mx.google.com with ESMTPSA id i3sm6492472eev.1.2013.05.09.13.45.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 May 2013 13:45:50 -0700 (PDT) Message-ID: <518C0B2B.9040909@falter.at> Date: Thu, 09 May 2013 22:46:35 +0200 From: Erwin Brandstetter User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: pgsql-docs@postgresql.org Subject: Reference function arguments by name Content-Type: multipart/alternative; boundary="------------070002050007020301060702" X-Gm-Message-State: ALoCoQnYKhs1683rAXflen/FXPm2BA3/maSnsIM1uJqxL4F2XmPNUrk/uJG1VRbExzdcl6f8n2ht X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org This is a multi-part message in MIME format. --------------070002050007020301060702 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 > ). > 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 --------------070002050007020301060702 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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). 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
--------------070002050007020301060702--