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

From Tom Lane
Subject Re: WIP: default values for function parameters
Date
Msg-id 26519.1229184353@sss.pgh.pa.us
Whole thread Raw
In response to Re: WIP: default values for function parameters  (Dimitri Fontaine <dfontaine@hi-media.com>)
Responses Re: WIP: default values for function parameters  ("David E. Wheeler" <david@kineticode.com>)
Re: WIP: default values for function parameters  ("Robert Haas" <robertmhaas@gmail.com>)
Re: WIP: default values for function parameters  (Dimitri Fontaine <dfontaine@hi-media.com>)
List pgsql-hackers
Dimitri Fontaine <dfontaine@hi-media.com> writes:
> Le 13 d�c. 08 � 11:39, Peter Eisentraut a �crit :
>> I personally thought that AS was a better idea.

> It seems some people want to be able to overload some default  
> parameters (but not others) and at the same time alias them to some  
> new label. I'm not sure I understand it all, but it seems an example  
> of it would be like:
>    SELECT xml_function(a, b: 'foo' AS bar);

> If this is what some people want when all the spare parts are bound  
> together, we don't have the option to use AS for both the meanings.

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.

However, after looking at the precedent of XMLELEMENT, it's hard to deny
that if the SQL committee ever chose to standardize named parameters,
AS is what they would use.  The chances that ":" would become the
standard are negligible --- that's not the sort of syntax they like
to standardize.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Sync Rep: First Thoughts on Code
Next
From: Bruce Momjian
Date:
Subject: Re: WIP: default values for function parameters