Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YUxI5-0005Yv-JT for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Mar 2015 13:00:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YUxI4-0006hm-VH for pgsql-bugs@arkaria.postgresql.org; Mon, 09 Mar 2015 13:00:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YUtkP-0006Jb-Of for pgsql-bugs@postgresql.org; Mon, 09 Mar 2015 09:13:13 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YUtkH-0002Mu-Ka for pgsql-bugs@postgresql.org; Mon, 09 Mar 2015 09:13:12 +0000 MIME-Version: 1.0 Subject: BUG #12843: pg_dump -O inserts four unwanted lines to the end of the dump To: pgsql-bugs@postgresql.org From: mage@mage.li Date: Mon, 09 Mar 2015 09:12:42 +0000 Message-ID: <20150309091242.2544.58018@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 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. Thank you. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs