Re: named parameters in SQL functions

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andrew Chernow <ac(at)esilo(dot)com>
Cc: 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 17:54:08
Message-ID: 162867790911150954o78e94acbs505f63c0432598e8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/11/15 Andrew Chernow <ac(at)esilo(dot)com>:
> Andrew Dunstan wrote:
>>
>> At Tom's suggestion I am looking at allowing use of parameter names in SQL
>> functions instead of requiring use of $1 etc. That raises the question of
>> how we would disambiguate a parameter name from a column name. Essentially,
>> ISTM, we could use some special marker such as @ (c.f. SQL Server) or :
>> (c.f. ecpg) or else we could have some rule that says which name takes
>> precedence. I think I prefer a special marker, other things being equal. Is
>> there a standard on this?
>>
>
> 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.

no, it should be safe (if you don't use for dollar quoting some like
$variablename$)

Pavel

>
> Would this be limited to sql functions?  I only ask because for non-sql
> functions we currently prefix parameter names with an underscore, but a
> built-in special marker would be much more desirable.
>
> --
> Andrew Chernow
> eSilo, LLC
> every bit counts
> http://www.esilo.com/
>
> --
> 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 Pavel Stehule 2009-11-15 18:08:04 Re: actualised funcs typmod patch
Previous Message Simon Riggs 2009-11-15 17:53:45 Re: Summary and Plan for Hot Standby