Re: dollar quoting

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: dollar quoting
Дата
Msg-id 24536.1076190662@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: dollar quoting  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: dollar quoting  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> After staring at the code for a long time, I think I see how to do this. 
> It's complicated a bit by the fact that $ is a valid identifier 
> character. So my current thinking is to say that if we see $ not in a 
> quote and not preceded by a valid identifier char then it is the start 
> of a $foo$ sequence. Or have I missed something? Can we validly see $ in 
> any other context?

Right, a $ should be considered to start a quote marker only if it's not
part of an identifier.  The backend lexer doesn't have a problem with
this because it's written in flex, but I can imagine that getting it
right in psql's ad-hoc parser might be tricky.

There was some discussion awhile back of converting psql to use flex
for interpreting its input, but I dunno how practical that really is.
I don't know how you get flex to do reasonable stuff with an incomplete
input string.  Still, it might be worth looking into.
        regards, tom lane


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

Предыдущее
От: Diego Montenegro
Дата:
Сообщение: Backend Code
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: PITR Dead horse?