Re: [GENERAL] Would you add a --dry-run to pg_restore? - Mailing list pgsql-general

From Francisco Olarte
Subject Re: [GENERAL] Would you add a --dry-run to pg_restore?
Date
Msg-id CA+bJJbxszmt7Pd8Xfrp2QFGbvQHLQ=aX2iomzO=S37D=JtG_=Q@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] Would you add a --dry-run to pg_restore?  (Edmundo Robles <edmundo@sw-argos.com>)
List pgsql-general
On Wed, Aug 2, 2017 at 7:10 PM, Edmundo Robles <edmundo@sw-argos.com> wrote:
>
> I  imagine   pg_restore can  execute  the instructions on dump but  don't  write on disk.   just like David said:
"tellme what is going to happen but don't actually do it" 


IIRC pg_restore does not execute SQL fully. It just passes the
commands to the server when in text mode, like psql, and builds some
commands and send them to the server to execute when in custom/tar
mode. I doubt it has the ability to validate the contents of the dump.

>> Edmundo Robles <edmundo@sw-argos.com> writes:
>> > I mean,  to   verify the integrity of backup  i do:
>> > gunzip -c backup_yesterday.gz | pg_restore  -d my_database  && echo
>> > "backup_yesterday is OK"

I also think if he is piping the dump must be text mode, I seem to
recall custom format needs seekable files, but not too sure about tar,
it should not. In this case, as previously suggested, a simple gunzip
-t is enough to verify backup file integrity, but checking internal
correctness is very difficult ( as it may even depend on server
configuration, i.e., needing some predefined users / locales /
encodings ).

Francisco Olarte.


pgsql-general by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: [GENERAL] Do not INSERT if UPDATE fails
Next
From: Rory Campbell-Lange
Date:
Subject: Re: [GENERAL] Would you add a --dry-run to pg_restore?