Re: psql/pg_dump vs. dollar signs in identifiers

Поиск
Список
Период
Сортировка
От Gregory Stark
Тема Re: psql/pg_dump vs. dollar signs in identifiers
Дата
Msg-id 871wfh9vvc.fsf@oxford.xeocode.com
обсуждение исходный текст
Ответ на Re: psql/pg_dump vs. dollar signs in identifiers  ("Jim C. Nasby" <decibel@decibel.org>)
Список pgsql-hackers
"Jim C. Nasby" <decibel@decibel.org> writes:

> Unless you're doing muti-line regex, what's the point of a $ anywhere
> but the end of the expression? Am I missing something? Likewise with ^.

Leaving out the backslashes, you can do things like (foo$|baz|qux)(baz|qux|)
to say that all 9 combinations of those two tokens are valid except that foo
must be followed by the empty second half.

But it can always be refactored into something more normal like
(foo|((baz|qux)(baz|qux)?))

> I'm inclined to escape $ as Tom suggested.

Yeah, I have a tendency to look for the most obscure counter-example if only
to be sure I really understand precisely how obscure it is. I do agree that
it's not a realistic concern. Especially since I never even realized we
handled regexps here at all :)

IIRC some regexp engines don't actually treat $ specially except at the end of
the regexp at all. Tom's just suggesting doing the same thing here where
complicated regexps are even *less* likely and dollars as literals more.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com



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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: psql/pg_dump vs. dollar signs in identifiers
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: PQescapeBytea* version for parameters