pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #11991: dangerous action of pg_dump
3+ messages / 3 participants
[nested] [flat]

* BUG #11991: dangerous action of pg_dump
@ 2014-11-17 21:42 tomek@rai.pl
  2014-11-18 03:02 ` Re: BUG #11991: dangerous action of pg_dump John R Pierce <pierce@hogranch.com>
  2014-11-18 05:22 ` Re: BUG #11991: dangerous action of pg_dump David G Johnston <david.g.johnston@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: tomek@rai.pl @ 2014-11-17 21:42 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      11991
Logged by:          Tomasz Kimaczynski
Email address:      tomek@rai.pl
PostgreSQL version: 9.2.9
Operating system:   Windows 2003,2008,2012 &amp; FreeBSD
Description:        

Recently, I realized pg_dump dangerous activity. In case when no dump is
made because of any error, created file size is 0 bytes. In case when this
file is used in simple backup procedure which make copy of dump file - 0
bytes files overwrite earlier correct dump files.
And we have no copies.
Conclusion: pg_dump can not create 0 bytes files - it should create
nothing.
I think it's important.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #11991: dangerous action of pg_dump
  2014-11-17 21:42 BUG #11991: dangerous action of pg_dump tomek@rai.pl
@ 2014-11-18 03:02 ` John R Pierce <pierce@hogranch.com>
  1 sibling, 0 replies; 3+ messages in thread

From: John R Pierce @ 2014-11-18 03:02 UTC (permalink / raw)
  To: pgsql-bugs

On 11/17/2014 1:42 PM, tomek@rai.pl wrote:
> Bug reference:      11991
> Logged by:          Tomasz Kimaczynski
> Email address:tomek@rai.pl
> PostgreSQL version: 9.2.9
> Operating system:   Windows 2003,2008,2012 &amp; FreeBSD
> Description:
>
> Recently, I realized pg_dump dangerous activity. In case when no dump is
> made because of any error, created file size is 0 bytes. In case when this
> file is used in simple backup procedure which make copy of dump file - 0
> bytes files overwrite earlier correct dump files.
> And we have no copies.
> Conclusion: pg_dump can not create 0 bytes files - it should create
> nothing.
> I think it's important.

perhaps your pg_dump script should check for errors from the pg_dump 
run, and if any errors, delete the erroneous dump.



-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #11991: dangerous action of pg_dump
  2014-11-17 21:42 BUG #11991: dangerous action of pg_dump tomek@rai.pl
@ 2014-11-18 05:22 ` David G Johnston <david.g.johnston@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: David G Johnston @ 2014-11-18 05:22 UTC (permalink / raw)
  To: pgsql-bugs

tomek wrote
> The following bug has been logged on the website:
> 
> Bug reference:      11991
> Logged by:          Tomasz Kimaczynski
> Email address:      

> tomek@

> PostgreSQL version: 9.2.9
> Operating system:   Windows 2003,2008,2012 &amp; FreeBSD
> Description:        
> 
> Recently, I realized pg_dump dangerous activity. In case when no dump is
> made because of any error, created file size is 0 bytes. In case when this
> file is used in simple backup procedure which make copy of dump file - 0
> bytes files overwrite earlier correct dump files.
> And we have no copies.
> Conclusion: pg_dump can not create 0 bytes files - it should create
> nothing.
> I think it's important.

Even if this were to be done there are other failure modes that will result
in partial dumps.  The correct answer is to always keep the last correct
dump until the next successful dump completes.  This is a minimum acceptable
practice.

Tools can make your life easier but this special case is more likely to do
harm than good if people test a quick fail mode and see their original file
remain when it should be clobbered.  If anything pg_dump should error if the
target dump file already exists.

If you are talking about your own copy process than that is your
responsibility.  Copying files without even rudimentary checks that the
dumped file is complete is simply being negligent.  In theory you should
restore the file and run some queries before declaring it good but at
minimum file size and program return code checks are needed.  Specifically
if the dump file is considerably smaller than previous versions you should
not remove the old version automatically.  Zero always qualifies but even
100 meg decrease should give pause and prompt human evaluation.

David J.




--
View this message in context: http://postgresql.nabble.com/BUG-11991-dangerous-action-of-pg-dump-tp5827321p5827327.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2014-11-18 05:22 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17 21:42 BUG #11991: dangerous action of pg_dump tomek@rai.pl
2014-11-18 03:02 ` John R Pierce <pierce@hogranch.com>
2014-11-18 05:22 ` David G Johnston <david.g.johnston@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox