Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edk4b-0004XI-5f for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jan 2018 21:56:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1edk4a-000077-JD for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jan 2018 21:56:12 +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_2) (envelope-from ) id 1edk4a-00006y-Cb for pgsql-hackers@lists.postgresql.org; Mon, 22 Jan 2018 21:56:12 +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.89) (envelope-from ) id 1edk4X-0005zX-Or for pgsql-hackers@lists.postgresql.org; Mon, 22 Jan 2018 21:56:11 +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 w0MLu7fs017973 for ; Mon, 22 Jan 2018 16:56:07 -0500 From: Tom Lane To: pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Move handling of database properties from pg_dumpall into pg_dum In-reply-to: <12453.1516655001@sss.pgh.pa.us> References: <12453.1516655001@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 22 Jan 2018 16:03:21 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17971.1516658167.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jan 2018 16:56:07 -0500 Message-ID: <17972.1516658167@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > Specifically, I see failures like this on machines where the prevailing > locale isn't C or US: > pg_restore: [archiver (db)] Error while PROCESSING TOC: > pg_restore: [archiver (db)] Error from TOC entry 4871; 2618 34337 RULE r= test_emp rtest_emp_del pgbf > pg_restore: [archiver (db)] could not execute query: ERROR: invalid inp= ut syntax for type money: "$0.00" > LINE 3: ... ("old"."ename", CURRENT_USER, 'fired'::"bpchar", '$0.00'::".= .. > ^ > Command was: CREATE RULE "rtest_emp_del" AS > ON DELETE TO "rtest_emp" DO INSERT INTO "rtest_emplog" ("ename", "w= ho", "action", "newsal", "oldsal") > VALUES ("old"."ename", CURRENT_USER, 'fired'::"bpchar", '$0.00'::"mone= y", "old"."salary"); Actually ... maybe what this is pointing out is a pre-existing deficiency in pg_dump, which is that it's failing to lock down lc_monetary during restore. Arguably, we should teach _doSetFixedOutputState to set lc_monetary to whatever prevailed in the dump session, just as we do for client_encoding. I seem now to recall some user complaints about unsafety of dump/restore for "money" values, which essentially is the problem we're seeing here. I think the reason we haven't done this already is fear of putting platform-dependent lc_monetary values into dump scripts. That's certainly an issue, but it seems a minor one: at worst, you'd have to not use --single-transaction when restoring on a different platform, so you could ignore an error from the SET command. While this would fix the specific problem we're seeing in the buildfarm, I'm thinking we'd still need to do what I said in the previous message, and change pg_dump so that the restore session will absorb ALTER DATABASE settings before proceeding. Otherwise, at minimum, we have a hazard of differing behaviors in serial and parallel restores. It might be that lc_monetary is the only GUC that makes a real difference for this purpose, but I haven't got much faith in that proposition at the moment. regards, tom lane