Re: BUG #7792: pg_dump does not treat -c flag correctly when using tar format

From: Eli Mesika <emesika(at)redhat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7792: pg_dump does not treat -c flag correctly when using tar format
Date: 2013-01-07 09:08:23
Message-ID: 938821469.1644658.1357549703303.JavaMail.root@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

----- Original Message -----
> From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> To: emesika(at)redhat(dot)com
> Cc: pgsql-bugs(at)postgresql(dot)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(at)redhat(dot)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
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dave Page 2013-01-07 09:43:49 Re: BUG #7781: pgagent incorrect installation
Previous Message Aleksander Shniperson 2013-01-07 06:47:03 Re: BUG #7781: pgagent incorrect installation