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