Re: Comments with embedded single quotes

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Comments with embedded single quotes
Дата
Msg-id 18683.962247574@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Comments with embedded single quotes  (Richard Harvey Chapman <hchapman@3gfp.com>)
Ответы Re: Comments with embedded single quotes
Список pgsql-general
Richard Harvey Chapman <hchapman@3gfp.com> writes:
> Are single quotation marks not allowed in comments?

> test2=# /* John's cat is fat. */
> test2'#
> test2'# '*/
> test2-# ;
> ERROR:  Unterminated quoted string
> test2=#

They are, but it looks like psql's primitive parser is confused here.
What the backend sees when this is sent is
    /* comment */

    '*/

and it quite properly complains that the string starting '*/ is not
terminated.  But it looks like psql mistakenly thinks that ' nests
inside /* ... */:

regression=# /*aaa
regression*# 'sss
regression'# ddd
regression'# */
regression'# 'sss
regression*# */
regression-#

Notice the pattern of the 'state' markers in the prompts.  It seems
to get the reverse case correct though:

regression-# 'foo
regression'# /*bar
regression'# '
regression-#

Over to you, Peter...

            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Comments with embedded single quotes
Следующее
От: igor
Дата:
Сообщение: test