pg_dump -Fd must create directory

From: François Beausoleil <francois(at)teksol(dot)info>
To: Postgres List <pgsql-general(at)postgresql(dot)org>
Subject: pg_dump -Fd must create directory
Date: 2012-09-12 11:12:58
Message-ID: C8A4F547-486B-490D-8EEA-883179C5734A@teksol.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all!

Why must pg_dump create a fresh new directory everytime? I'm running some tests where I dump a database to a directory, git init and git add --all, then dump again. When I did that after doing some modifications (specifically creating a new table and adding a few hundred thousand records), git status told me some files had been renamed and others were removed. I worked around this by dumping to a new directory, then moving .git manually.

My real-world use case is I have a largish database (46 GiB gzip'd dump) that I dump every few hours, and some tables are essentially static. I was thinking of saving some network traffic by transferring only the delta.

Any thoughts on this? Is this something that can or can be made to change? Where are the IDs used in the dump coming from? Can they be made stable?

Thanks!
François Beausoleil

$ cat a.sh
PGDATABASE=${USER}
rm -rf thedump thedump2
psql -c "select * into a from generate_series(1, 100000, 1) as t1(a)"
pg_dump -Fd --file=thedump
cd thedump && git init && git add --all . && git commit -m "initial" && cd ..
psql -c "select * into b from generate_series(1, 100000, 1) as t1(b)"
pg_dump -Fd --file=thedump2
mv thedump/.git thedump2/
cd thedump2
git status --short

$ sh a.sh
SELECT 100000
Initialized empty Git repository in /root/tmp/thedump/.git/
[master (root-commit) 9f8dc9f] initial
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 1882.dat.gz
create mode 100644 toc.dat
SELECT 100000
D 1882.dat.gz
M toc.dat
?? 1886.dat.gz
?? 1887.dat.gz

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raymond O'Donnell 2012-09-12 11:19:27 Re: Displaying image from php script displays string
Previous Message Edson Richter 2012-09-12 11:06:00 Re: Compressed binary field