vacuumlo nonstandard use of \\ in a string literal

Поиск
Список
Период
Сортировка
Искать

vacuumlo nonstandard use of \\ in a string literal

От:
Michael Fuhr <mike@fuhr.org>
Дата:
In 8.1 and HEAD, if a role has escape_string_warning enabled then
vacuumlo elicits the following warning:

WARNING:  nonstandard use of \\ in a string literal at character 323
HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.

How backward compatible should vacuumlo remain?  This patch changes
the string to E'...' but other ways would be to use dollar quotes
or ESCAPE.

-- 
Michael Fuhr

Re: vacuumlo nonstandard use of \\ in a string literal

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Michael Fuhr  writes:
> How backward compatible should vacuumlo remain?  This patch changes
> the string to E'...' but other ways would be to use dollar quotes
> or ESCAPE.

In this particular case, a far better answer is to replace

> ! 	strcat(buf, "      AND s.nspname NOT LIKE 'pg\\\\_%'");

with

> ! 	strcat(buf, "      AND s.nspname !~ '^pg_'");

which sidesteps the problem entirely and is more readable to boot.

			regards, tom lane
FAQ