Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 22602634CD4 for ; Thu, 22 Apr 2010 14:11:02 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 51285-01-4 for ; Thu, 22 Apr 2010 17:10:51 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f221.google.com (mail-bw0-f221.google.com [209.85.218.221]) by mail.postgresql.org (Postfix) with ESMTP id CA6316350BD for ; Thu, 22 Apr 2010 13:27:53 -0300 (ADT) Received: by bwz21 with SMTP id 21so8306643bwz.35 for ; Thu, 22 Apr 2010 09:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:received:message-id :subject:from:to:content-type; bh=j+OmfPvBluXgbOmrAf8iuBWVuKXHmjhn3+rGAJd9hRI=; b=AIBdy33+idtwiiaEpwqFHEzOZ5ke6jg88rWAhBa+nWszX/Q6mkGsh+1gESYasF4nSC DxePW78o0mK3drpj8ANfr9grmXU1m4PrW1tntdbP92vhiH0r9jLFu04sTeGBGV3OoIxl 1br5udcst0h8JVWNjsFQFfKjKPqFdoX5W+yn4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=D6Jq7RcxjjiBWmVf1Zr0JJrrRSEofbS99KBst85frnc/8KX5fTbxLXfG5zN0S2E6ER Zocm2KwrOZv532iANXWQvYaa8PbRdRxcfA/O8UBAkTB9cDw92syg+waAFUJJvZTn1weC md/b03llBVGPKhUdebCWDJpwDvKbEgEVKtQ4w= MIME-Version: 1.0 Received: by 10.204.69.76 with HTTP; Thu, 22 Apr 2010 09:27:52 -0700 (PDT) Date: Thu, 22 Apr 2010 18:27:52 +0200 Received: by 10.204.1.136 with SMTP id 8mr3211816bkf.92.1271953672468; Thu, 22 Apr 2010 09:27:52 -0700 (PDT) Message-ID: Subject: Named parameter notation in Postgresql 9.0 From: Ingmar Brouns To: pgsql-testers@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.889 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201004/10 X-Sequence-Number: 80 Hi, I was testing the new named parameter notation for calling functions in 9.0 http://developer.postgresql.org/pgdocs/postgres/sql-syntax-calling-funcs.html Named parameter notation is really nice, however, it is still enforced that all parameters after the first parameter with a default value must also have a default value in the function declaration. so the following function will fail to compile: FUNCTION foo(a INTEGER DEFAULT 0, b INTEGER) ERROR: input parameters after one with a default value must also have defaults As the developer documentation states (35.4.6): --------------- Although the use of named argument notation could allow this restriction to be relaxed, it's still enforced so that positional argument notation works sensibly. --------------- One of the main benefits of named notation is that it offers clarity when you have a large number of parameters. When a function has a large number of parameters, then it is often desirable to logically group the parameters together at the function declaration, instead of having to move some of them to the end because they have a default value. Wouldn't it be better to relax this constraint, and instead check that when a function is being called using positional notation, that all parameters must have been provided until (including) the last parameter that has no default value. Kind regards, Ingmar Brouns