vacuumlo nonstandard use of \\ in a string literal

Started by Michael Fuhrover 20 years ago2 messagespatches
Jump to latest
#1Michael 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

Attachments:

vacuumlo.patchtext/plain; charset=us-asciiDownload+2-2
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Fuhr (#1)
Re: vacuumlo nonstandard use of \\ in a string literal

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