Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YnzHL-0001Gj-7s for pgsql-bugs@arkaria.postgresql.org; Fri, 01 May 2015 00:58:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YnzHK-0004bt-OE for pgsql-bugs@arkaria.postgresql.org; Fri, 01 May 2015 00:58:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YnzHK-0004bn-3c for pgsql-bugs@postgresql.org; Fri, 01 May 2015 00:58:06 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1YnzHG-0006ey-Fy for pgsql-bugs@postgresql.org; Fri, 01 May 2015 00:58:05 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1YnzHD-0004Fk-8Q; Thu, 30 Apr 2015 20:57:59 -0400 Date: Thu, 30 Apr 2015 20:57:59 -0400 From: Bruce Momjian To: mage@mage.li Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #12843: pg_dump -O inserts four unwanted lines to the end of the dump Message-ID: <20150501005759.GA6342@momjian.us> References: <20150309091242.2544.58018@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150309091242.2544.58018@wrigleys.postgresql.org> User-Agent: Mutt/1.5.20 (2009-06-14) 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 On Mon, Mar 9, 2015 at 09:12:42AM +0000, mage@mage.li wrote: > The following bug has been logged on the website: > > Bug reference: 12843 > Logged by: Péter Mózes Merl > Email address: mage@mage.li > PostgreSQL version: 9.3.0 > Operating system: Any > Description: > > It affects many versions. > > The manual says about -O: > > "To make a script that can be restored by any user, but will give that user > ownership of all the objects, specify -O." > > This actually does not work because there are four lines inserted at the end > of the dump: > > REVOKE ALL ON SCHEMA public FROM PUBLIC; > REVOKE ALL ON SCHEMA public FROM postgres; > GRANT ALL ON SCHEMA public TO postgres; > GRANT ALL ON SCHEMA public TO PUBLIC; > > The problem is that the source and the target system might have different > users. Usually they do when we deploy Rails. > > Not to forget that Linux distributions have different default user than the > one created in FreeBSD (postgres vs pgsql). > > To load the dump by another user these four lines have to be removed. Which > is painful when the dump is large. It is needed more often than not. > > I suggest simply not inserting them when -O is set. I looked into this and -O says it controls the setting of _ownership_ of objects, but it does not control the _permissions_ on objects. Is there a use for not restoring permissions too? -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs