Re: BUG #13736: pg_dump should use E'' quotes - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: BUG #13736: pg_dump should use E'' quotes
Date
Msg-id CAKFQuwangrLOXh6XBGGp6R=iHDzj4ofHK_CJrfwE3csCMep+Nw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #13736: pg_dump should use E'' quotes  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #13736: pg_dump should use E'' quotes  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #13736: pg_dump should use E'' quotes  (Felipe Gasper <felipe@felipegasper.com>)
List pgsql-bugs
On Mon, Oct 26, 2015 at 5:33 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> felipe@felipegasper.com writes:
> > When dumping a DB whose name has a backslash in it, I get a warning lik=
e:
>
> > ------
> > pg_dump: WARNING:  nonstandard use of \\ in a string literal
> > LINE 1: ...) AS description FROM pg_database WHERE datname =3D 'i have =
/
> ...
> >                                                              ^
> > HINT:  Use the escape string syntax for backslashes, e.g., E'\\'.
> > ------
>
> It took me some time to reproduce that, but I eventually realized that
> you must have standard_conforming_strings turned off in your database
> settings.


=E2=80=8B[...]
=E2=80=8B


>
> Yes.  For one thing, there would immediately be zero chance of loading
> view definitions produced by pg_dump into any other DBMS,


Ironic...=E2=80=8Bwe cannot write a standard conforming string out because =
we are
concerned other databases will be unable to read it.

The OP is advised to set "escape_string_warning" to "off" if they also wish
to have "standard_conforming_strings" set to "off".  The question then is
whether we should do so during restore regardless of whether the user has
done so.

David J.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #13736: pg_dump should use E'' quotes
Next
From: Tom Lane
Date:
Subject: Re: BUG #13736: pg_dump should use E'' quotes