Обсуждение: vacuumlo nonstandard use of \\ in a string literal

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

vacuumlo nonstandard use of \\ in a string literal

От
Michael Fuhr
Дата:
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
Дата:
Michael Fuhr <mike@fuhr.org> 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