pg.ddx.io  pgsql-testers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ingmar Brouns <swingi@gmail.com>
To: pgsql-testers@postgresql.org
Subject: Named parameter notation in Postgresql 9.0
Date: Thu, 22 Apr 2010 18:27:52 +0200
Message-ID: <i2w1d47155c1004220927l9e7698d9v68cc12d203f6e93f@mail.gmail.com> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <i2w1d47155c1004220927l9e7698d9v68cc12d203f6e93f@mail.gmail.com>
Permalink:  ../i2w1d47155c1004220927l9e7698d9v68cc12d203f6e93f@mail.gmail.com/
Also on:    postgresql.org/message-id/i2w1d47155c1004220927l9e7698d9v68cc12d203f6e93f@mail.gmail.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-testers@postgresql.org
  Cc: swingi@gmail.com
  Subject: Re: Named parameter notation in Postgresql 9.0
  In-Reply-To: <i2w1d47155c1004220927l9e7698d9v68cc12d203f6e93f@mail.gmail.com>
  References: <i2w1d47155c1004220927l9e7698d9v68cc12d203f6e93f@mail.gmail.com>

* 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