Re: named parameters in SQL functions

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: 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:26:01
Message-ID: 2E8C4D49-15BC-46F6-9305-DC161871C4B4@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2009-11-15 18:30:39 Re: Summary and Plan for Hot Standby
Previous Message Joachim Wieland 2009-11-15 18:19:39 Listen / Notify - what to do when the queue is full