Re: WIP: Allow SQL-language functions to reference parameters by parameter name

From: Darren Duncan <darren(at)darrenduncan(dot)net>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: Allow SQL-language functions to reference parameters by parameter name
Date: 2011-04-05 19:32:21
Message-ID: 4D9B6E45.5090209@darrenduncan.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Merlin Moncure wrote:
> On Fri, Mar 25, 2011 at 10:05 PM, David E. Wheeler <david(at)kineticode(dot)com> wrote:
>> On Mar 25, 2011, at 9:12 PM, Robert Haas wrote:
>>
>>> As I've said before, I believe that the root cause of this problem is
>>> that using the same syntax for variables and column names is a bad
>>> idea in the first place. If we used $foo or ?foo or ${foo} or $.foo
>>> or &&foo!!$#? to mean "the parameter called foo", then this would all
>>> be a non-issue.
>> Yes *please*. Man that would make maintenance of such functions easier.
>
> +1 on using $foo. Even with the standardization risk I think it's the
> best choice. Prefer $"foo" to ${foo} though.

The "foo" syntax should be orthogonal to everything else and not have anything
specifically to do with parameters. Rather, "foo" anywhere is just a delimited
case-sensitive identifier and can be used anywhere that foo can where the latter
is a case-insensitive identifier.

As for the SQL standard for bind parameters, as I recall they use :foo and so
:"foo" would be the sensitive more general case of that.

-- Darren Duncan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2011-04-05 19:33:00 Re: WIP: Allow SQL-language functions to reference parameters by parameter name
Previous Message Robert Haas 2011-04-05 19:27:39 Re: Visibillity testing - some numbers on current performance.