Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE
Дата
Msg-id CAKFQuwbJhEdos8S4ea0hJXfAToGL1y8qFsOeCPzZzu+NkixcXA@mail.gmail.com
обсуждение исходный текст
Ответ на ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE  (Bryn Llewellyn <bryn@yugabyte.com>)
Ответы Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Wed, Oct 5, 2022 at 5:17 PM Bryn Llewellyn <bryn@yugabyte.com> wrote:
The doc for "quote_ident()" says this:

«
https://www.postgresql.org/docs/14/functions-string.html
Returns the given string suitably quoted to be used as an identifier in an SQL statement string. Quotes are added only if necessary (i.e., if the string contains non-identifier characters or would be case-folded). Embedded quotes are properly doubled.
»
But it's incorrect w.r.t. "quotes are added only if necessary" for this to return FALSE:

select 'dog$' = quote_ident('dog$');

The documentation also says:

"Note that dollar signs are not allowed in identifiers according to the letter of the SQL standard, so their use might render applications less portable."


So I can see an argument for the existing behavior.  It doesn't seem worth changing in any case.  And I don't really see the documentation being improved by covering this corner case in detail when the current behavior is at least intuitive.
David J.

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

Предыдущее
От: Bryn Llewellyn
Дата:
Сообщение: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE
Следующее
От: Tom Lane
Дата:
Сообщение: Re: ('dog$house' = quote_ident('dog$house')) is surprisingly FALSE