Re: WIP: default values for function parameters

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

> I personally agree that AS seems more SQL-ish, but that's in the eye
> of the beholder.
>
> The argument about ambiguity in XMLELEMENT is bogus becase XMLELEMENT
> doesn't (and won't) have named parameters. But it is true that
> XMLELEMENT is doing something subtly different with the AS clause than
> what a named parameter would do; so you could argue that there's a
> potential for user confusion there.

It's not ambiguous unless for some reason you wanted to support doing
both of those things at the same time, but I'm having a hard time
coming up with a realistic use case for that. Still, I think we
probably do want to at least leave the door open to do both things at
different times. For the XMLELEMENT-type case, "value AS label" seems
far superior to "label: value", so if you're going to pick one syntax
for both things, it should be that one.

Alternatively, using "label: value" for identifying which parameter is
intended to get the value and "value AS label" for relabelling seems
OK too, though your argument about standards-compliance is a valid
one.

...Robert

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-12-13 18:02:49 Stats target increase vs compute_tsvector_stats()
Previous Message Markus Wanner 2008-12-13 17:15:09 Re: Sync Rep: First Thoughts on Code