Re: named parameters in SQL functions

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: named parameters in SQL functions
Дата
Msg-id 407d949e0911151019t4dbbdb48uea26bd064d342ad7@mail.gmail.com
обсуждение исходный текст
Ответ на Re: named parameters in SQL functions  (Andrew Chernow <ac@esilo.com>)
Ответы Re: named parameters in SQL functions
Список pgsql-hackers
On Sun, Nov 15, 2009 at 5:49 PM, Andrew Chernow <ac@esilo.com> wrote:
> 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.

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.

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.

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.

--
greg


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: named parameters in SQL functions
Следующее
От: Joachim Wieland
Дата:
Сообщение: Listen / Notify - what to do when the queue is full