Re: dollar-quoting in psql and in general
От | Andrew Dunstan |
---|---|
Тема | Re: dollar-quoting in psql and in general |
Дата | |
Msg-id | 411ADF00.9000708@dunslane.net обсуждение исходный текст |
Ответ на | dollar-quoting in psql and in general (Philip Warner <pjw@rhyme.com.au>) |
Ответы |
Re: dollar-quoting in psql and in general
|
Список | pgsql-hackers |
Philip Warner wrote: > While trying to understand dollar-quoting, I found the following in psql: > > select $a$ hello $a$; > > behaves as expected, but psql does not like > > select $a$ \ $a$; > or > select $a$ \\ $a$; > > Should it? How should a dollar-quote handle: > > $a$ \$a\$a $a$ > > ? > > andrew=# select $a$ \ $a$;?column? ---------- \ (1 row) andrew=# select $a$ \\ $a$;?column? ---------- \\ (1 row) It is behaving as *I* expect, and as designed. \ is not magical inside dollar quotes, and if it were it would defeat the whole purpose of having them. Dollar quotes are really designed for strings that are reparsed - most typically function bodies. The strings inside them are therefore totally opaque, and there is no escape character. Otherwise, if we wanted the plpgsql parsers, say, to see \ we'd have to write \\, and the idea was to get away from \\, \', '' and friends. cheers andrew
В списке pgsql-hackers по дате отправления: