Re: WIP: default values for function parameters

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Dimitri Fontaine <dfontaine(at)hi-media(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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>, 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 16:09:50
Message-ID: 200812131609.mBDG9ox04886@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dimitri Fontaine wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> Le 13 dc. 08 11:39, Peter Eisentraut a crit :
> > On Friday 12 December 2008 20:05:57 Tom Lane wrote:
> >> Excellent. I checked that psql's colon-variable feature behaves the
> >> same. So it looks like the proposed "name: value" syntax would
> >> indeed
> >> not break any existing features. Barring better ideas I think we
> >> should
> >> go with that one.
> >
> > 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 agree "AS" is better. And why would the "AS" above be inside the
parentheses; I assume it would be:

SELECT xml_function(a, b: 'foo') AS bar;

Giving labels to parameters passed into functions makes no sense.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2008-12-13 16:12:23 Re: WIP: default values for function parameters
Previous Message Tom Lane 2008-12-13 16:05:53 Re: WIP: default values for function parameters