Re: named parameters in SQL functions

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, Andrew Chernow <ac(at)esilo(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: named parameters in SQL functions
Date: 2009-11-15 18:42:00
Message-ID: 162867790911151042r6b089e6aqc9882088647da05@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/11/15 David E. Wheeler <david(at)kineticode(dot)com>:
> On Nov 15, 2009, at 10:19 AM, Greg Stark wrote:
>
>>> I like the special marker idea.  A '$' would be nice because its already in
>>> use for similar purposes, but I think that would lead to ambiguity with
>>> dollar quoting.
>>
>> I think that would be a big break with everything else and very
>> non-sql-ish. We don't use these in plpgsql and we don't use them
>> anywhere else in sql.
>
> *ahem* $1 *ahem*
>
>> Moreover you would still have conflicts possible because sql can quote
>> identifiers so people can have columns named "$foo". You would have a
>> weird syntactic detail where "$foo" would mean something different
>> than $foo even though they're both valid identifiers.
>
> Same with Foo and "Foo", no?
>
>> I'm not sure it wouldn't conflict with some drivers either. DBI uses
>> :foo and ? but I have a vague recollection some drivers did use $foo.
>
> I don't think that would come up, because the $vars are in the body of the function, not in a typical driver call.
>
> Personally, I like $var, but @var would be okay, and @@var is acceptable. But I'm JAPH, so my biases should be obvious.

@var or @@var should be a break for people from MySQL. @var are r/w in
MySQL and @@var are global in T-SQL. So people could be confused.

Regards
Pavel

>
> Best,
>
> David
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-11-15 18:43:05 Re: patch - Report the schema along table name in a referential failure error message
Previous Message Heikki Linnakangas 2009-11-15 18:37:52 Re: Summary and Plan for Hot Standby