Re: proposal: ANSI SQL 2011 syntax for named parameters

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: ANSI SQL 2011 syntax for named parameters
Date: 2012-12-29 08:14:23
Message-ID: CAFj8pRBvjpzfx3Nq-JwU8FPS6Vayah5VQ+ePKzMUaOwVXgvCog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/12/28 Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>:
> On 29/12/12 10:19, Peter Eisentraut wrote:
>
> On 12/28/12 11:22 AM, Pavel Stehule wrote:
>
> I am not sure, but maybe is time to introduce ANSI SQL syntax for
> functions' named parameters
>
> It is defined in ANSI SQL 2011
>
> CALL P (B => 1, A => 2)
>
> instead PostgreSQL syntax CALL ( B := 1, A := 2)
>
> I agree it's probably time.
>
> * should we support both - probably yes
>
> yes
>
> * how long time we will support pg syntax? - 2..5..ever years
>
> * when we mark pg syntax as obsolete?
>
> * when we remove pg syntax?
>
> The := syntax was introduced in 9.0, so it is by now well entrenched. I
> don't think we should remove it at all any time soon.
>
> As for documentation, just state how it is. The standard syntax is =>,
> but because of $various_issues, older versions only support :=.
>
>
>
> To be honest I prefer := as it looks neater than =>, in part because I first
> saw that notation when I was learning ALGOL 60 and liked the justification
> they gave in the manual.
>
> In fact I find => ugly and counter intuitive as I keep having the feeling
> that it points the wrong way, because A => 2 suggests to me that you are
> setting '2' to the value of 'A' which is plain daft!

It doesn't mean ASSIGN but maybe ASSOCIATE - for me the best natural
is syntax, that we don't use (or is used less in SQL/XML) with keyword
AS

supported syntax -- A := 2; ANSI SQL -- A => 2; and my natural (but it
subjective) -- 2 AS A

I don't know a original motivation for using symbol '=>' - but is
widely used for associative arrays in Perl like languages.

And if I can go to deeper history - it is used for named parameters in
ADA language http://en.wikibooks.org/wiki/Ada_Programming/Subprograms

Regards

Pavel

>
> I am sure there are worse standardisation formats - but for some reason, I
> find this one disproportionately irritating! :-)
>
> So I would much prefer to keep the old format, if at all possible.
>
>
> Cheers,
> Gavin
>
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message James Cloos 2012-12-29 10:23:31 Re: ILIKE vs indices
Previous Message Pavel Stehule 2012-12-29 07:04:24 Re: dynamic SQL - possible performance regression in 9.2