Re: WIP: default values for function parameters - Mailing list pgsql-hackers

From Robert Haas
Subject Re: WIP: default values for function parameters
Date
Msg-id 603c8f070812130922v521ec2c1s77e2602cac4e2b35@mail.gmail.com
Whole thread Raw
In response to Re: WIP: default values for function parameters  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-hackers by date:

Previous
From: Markus Wanner
Date:
Subject: Re: Sync Rep: First Thoughts on Code
Next
From: Tom Lane
Date:
Subject: Stats target increase vs compute_tsvector_stats()