Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZqpOu-0000wa-7p for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Oct 2015 21:33:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZqpOt-0007XW-F8 for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Oct 2015 21:33:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZqpOH-0006q8-1J for pgsql-bugs@postgresql.org; Mon, 26 Oct 2015 21:33:17 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZqpOA-0006CA-3B for pgsql-bugs@postgresql.org; Mon, 26 Oct 2015 21:33:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t9QLX6X5003220; Mon, 26 Oct 2015 17:33:06 -0400 From: Tom Lane To: felipe@felipegasper.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13736: pg_dump should use E'' quotes In-reply-to: <20151026204847.3021.73649@wrigleys.postgresql.org> References: <20151026204847.3021.73649@wrigleys.postgresql.org> Comments: In-reply-to felipe@felipegasper.com message dated "Mon, 26 Oct 2015 20:48:47 -0000" Date: Mon, 26 Oct 2015 17:33:06 -0400 Message-ID: <3219.1445895186@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org felipe@felipegasper.com writes: > When dumping a DB whose name has a backslash in it, I get a warning like: > ------ > pg_dump: WARNING: nonstandard use of \\ in a string literal > LINE 1: ...) AS description FROM pg_database WHERE datname = '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. This has been a deprecated setting since 9.1. > pg_dump should be using PostgreSQL’s own recommended syntax, should it not? > Is there anything that would break from making this change? Yes. For one thing, there would immediately be zero chance of loading view definitions produced by pg_dump into any other DBMS, or even into old versions of PG, without painstaking hand-editing to remove all the E's (and then also fix the string contents, which would likely be actively wrong without E). We could avoid the problem by having pg_dump force standard_conforming_strings to ON rather than adopting the prevailing database setting, but again that would complicate back-porting its output to older PG versions. It might also annoy people who are accustomed to seeing old-style strings in their dumps; presumably people who are still using standard_conforming_strings = OFF are a bit set in their ways. Basically there are a number of tradeoffs here and avoiding a purely cosmetic warning is the consideration that loses out. At some point we might decide that backward compatibility to old PG versions is no longer of interest; but what we'd probably do then is have pg_dump force standard_conforming_strings to ON, not adopt E'' syntax. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs