Re: Named arguments in function calls

From: elein <elein(at)varlena(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Named arguments in function calls
Date: 2004-01-25 21:43:25
Message-ID: 20040125134325.K19738@cookie.varlena.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I agree with Tom on this. Good operator combinations
are hard to find when you are creating new operators.
=> is a particularly good one.

Barring any override from the SQL200x standard,
I would strongly suggest AS, too.

elein
elein(at)varlena(dot)com

On Sun, Jan 25, 2004 at 02:54:12PM -0500, Tom Lane wrote:
> Greg Stark <gsstark(at)mit(dot)edu> writes:
> >> I've been looking (and coded) a little bit on named function calls.
> >> Calls on the form:
> >>
> >> foo (x => 13, y => 42)
> >>
> >> Implementing this means that the symbol => no longer can be defined
> >> by the user as an operator. It's not used as default in pg, but I
> >> just want to tell you up front in case you don't like that.
>
> > Is it really necessary to steal it? There's some precedent for special cases
> > in argument lists: "," is an operator in C yet it has special meaning in
> > function arguments.
>
> I'm not happy with the concept of "reserved operator names", either.
> I think a little more work ought to be put into the grammar to see if
> we can match Oracle's syntax without reserving the operator, and if we
> can't, choose a different syntax using a keyword instead of an operator.
> One that comes to mind immediately is AS:
>
> foo (13 as x, 42 as y)
>
> AS is already a fully reserved word, so this wouldn't break any existing
> applications. Furthermore it seems to fit more naturally with SQL
> syntax in general --- you could see this as equivalent to the column
> renaming that AS does in a SELECT list.
>
> I've never been impressed with the concept of copying Oracle just
> because they're Oracle. This seems like a case where they've chosen
> an unfortunate syntax that we should not break things to emulate.
>
> BTW, has anyone looked to see whether SQL 200x has pre-empted this
> decision yet?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dennis Bjorklund 2004-01-25 21:52:09 Re: Named arguments in function calls
Previous Message Tom Lane 2004-01-25 20:55:23 Re: Getting the results columns before execution