Re: WIP: default values for function parameters

From: "Robert Haas" <robertmhaas(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "Gregory Stark" <stark(at)enterprisedb(dot)com>, "Grzegorz Jaskiewicz" <gj(at)pointblue(dot)com(dot)pl>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>, "Peter Eisentraut" <peter_e(at)gmx(dot)net>
Subject: Re: WIP: default values for function parameters
Date: 2008-12-12 14:22:29
Message-ID: 603c8f070812120622r64966fdel210187cb728e947@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> I'm okay with AS if that's the way it has to be, but what about a colon
> right at the end of the label? A cast is two colons, so no conflict there:
>
> SELECT foo(1, name: 'bar', quantity: 10);
>
> No doubt I'm missing something…

I'd just like to mention that there are two different cases to
consider here. One is when you want to pass some optional parameters,
but there are enough of them that it's inconvenient to have them in
some particular order. This is the case I think you're primarily
catering to here.

The other is when you want the function that gets called to magically
know what name the system would have assigned to the column had the
expression been used in a select list, so that you can write things
xmlify(foo) and get <foo>...data from foo...</foo>.

I think the AS syntax makes a lot of sense for the second one, but not
so much for the first one. Maybe we need both:

[keyword:] paramater_expression [AS label]

...Robert

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-12 14:22:30 Re: WIP: default values for function parameters
Previous Message Sam Mason 2008-12-12 14:14:48 Re: WIP: default values for function parameters