|From:||Joel Jacobson <joel(at)gluefinance(dot)com>|
|Subject:||pg_dump --split patch|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
Dear fellow hackers,
Problem: A normal diff of two slightly different schema dump files (pg_dump
-s), will not produce a user-friendly diff, as you get all changes in the
Solution: I propose a new option to pg_dump, --split, which dumps each
object to a separate file in a user friendly directory structure:
[-f filename] : main dump file, imports each splitted part using \i
[-f filename]-split/[desc]/[tag]/[oid].sql : dump of the oid
Example: If the filename (-f) is "pg.dump", the following directory
structure would be created:
$ ./pg_dump -f /crypt/pg.dump --split -F p -s glue
In each such directory, one directory per object name is created.
If we would have a function "foobar" with oid "12345" it would be saved to:
In the "pg.dump" plain text file, the files are "linked in" using the "\i"
psql command, e.g.:
Potential use-case scenarios:
*) Version control your database schema, by exporting it daily (using
--split) and commiting the differences.
*) Compare differences of schema dumps created in different points in time.
Since objects are stored in separate files, it is easier to see what areas
were modified, compared to looking at the diff of two entire schemas.
*) Restore only some objects, based on type (e.g., only the functions) or
name (e.g. only fucntions of certain name/names).
I've tested the patch for both the latest HEAD (9.1devel) as well as 8.4.6.
|Next Message||Peter Geoghegan||2010-12-28 16:04:18||Re: "writable CTEs"|
|Previous Message||tv||2010-12-28 15:55:12||Re: estimating # of distinct values|