Re: back slash separated values

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: back slash separated values
Дата
Msg-id 16094.1143037766@sss.pgh.pa.us
обсуждение исходный текст
Ответ на back slash separated values  ("surabhi.ahuja" <surabhi.ahuja@iiitb.ac.in>)
Список pgsql-general
"surabhi.ahuja" <surabhi.ahuja@iiitb.ac.in> writes:
> mod_pattern := mod_of_study || ''\\'' ||  $2;

If this is in a function body, you need four backslashes not two, for
the same reason that you need to double the quote marks: one level of
quotes and backslashes is eaten when the function body is parsed as a
string literal.

If you are on a recent PG version, you should consider switching to
dollar-quotes for the function body.  Then you don't need to double
anything, and the constant looks the same as it would look in plain
SQL: mod_of_study || '\\' || $2;

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Enforcing serial uniqueness?
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Enforcing serial uniqueness?