Skip site navigation (1) Skip section navigation (2)

Named parameter notation in Postgresql 9.0

From: Ingmar Brouns <swingi(at)gmail(dot)com>
To: pgsql-testers(at)postgresql(dot)org
Subject: Named parameter notation in Postgresql 9.0
Date: 2010-04-22 16:27:52
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-testers

I was testing the new named parameter notation for calling functions in 9.0

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:


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

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


pgsql-testers by date

Next:From: Josh BerkusDate: 2010-04-22 22:22:26
Subject: Re: Named parameter notation in Postgresql 9.0
Previous:From: Josh BerkusDate: 2010-04-15 23:45:27
Subject: Re: schema.table.column syntax no longer supported?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group