Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TsGII-0008JM-4T for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Jan 2013 17:15:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TsGIH-0006c1-JP for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Jan 2013 17:15:25 +0000 Received: from magus.postgresql.org ([87.238.57.229]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ts8h5-00045H-H2 for pgsql-bugs@postgresql.org; Mon, 07 Jan 2013 09:08:31 +0000 Received: from mx4-phx2.redhat.com ([209.132.183.25]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Ts8h0-00026D-Bw for pgsql-bugs@postgresql.org; Mon, 07 Jan 2013 09:08:30 +0000 Received: from zmail13.collab.prod.int.phx2.redhat.com (zmail13.collab.prod.int.phx2.redhat.com [10.5.83.15]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r0798Nq8007245; Mon, 7 Jan 2013 04:08:23 -0500 Date: Mon, 7 Jan 2013 04:08:23 -0500 (EST) From: Eli Mesika To: Tom Lane Cc: pgsql-bugs@postgresql.org Message-ID: <938821469.1644658.1357549703303.JavaMail.root@redhat.com> In-Reply-To: <10105.1357518726@sss.pgh.pa.us> Subject: Re: BUG #7792: pg_dump does not treat -c flag correctly when using tar format MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.36.4.170] X-Mailer: Zimbra 7.2.0_GA_2669 (ZimbraWebClient - FF3.0 (Linux)/7.2.0_GA_2669) X-Pg-Spam-Score: -6.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 ----- Original Message ----- > From: "Tom Lane" > To: emesika@redhat.com > Cc: pgsql-bugs@postgresql.org > Sent: Monday, January 7, 2013 2:32:06 AM > Subject: Re: [BUGS] BUG #7792: pg_dump does not treat -c flag correctly when using tar format > > emesika@redhat.com writes: > > 1) pg_dump -F t -U postgres -f test.tar test > > 2) tar xvf test.tar to any directory > > 3) vi restore.sql > > * restore.sql includes DROP statements for each object even tough > > -c flag > > was not given > > I believe this is intentional - at least, pg_backup_tar.c goes out of > its way to make it happen. (The forcible setting of ropt->dropSchema > in _CloseArchive is the cause, and it's hard to see why that would be > there unless the author intended this effect.) Perhaps we should > remove > that, but it would be an incompatible change. Arguing for or against > it really requires a model of what people would be doing with the > restore.sql script. I'm not entirely convinced that it should be > considered equivalent to what you'd get from a plain dump run. Tom, thanks for the quick respond. I find that very confusing: Currently, in order to use the pg_restore (tar format), you will have to create first the database with the same schema you are going to restore while the most convenient usage is to create a new empty database and run the restore. Also, that contradict with the pg_dump -C flag that adds database creation statement and it is clear that DROP statements will fail on a clean database. Regards Eli > > 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