2010/12/28 Gurjeet Singh
<singh.gurjeet@gmail.com>I would suggest the directory structure as:
/crypt/pg.dump-split/schema-name-1/VIEWS/view-name-1.sql
/crypt/pg.dump-split/schema-name-1/TABLES/table-name-1.sql
...
/crypt/pg.dump-split/schema-name-2/VIEWS/view-name-1.sql
/crypt/pg.dump-split/schema-name-2/TABLES/table-name-1.sql
This might n be more amenable to diff'ing the different dumps. Schemas are logical grouping of other objects and hence making that apparent in your dump's hierarchy makes more sense.
Thanks Gurjeet and Tom for good feedback!
I've made some changes and attached new patches.
Looks much better now I think!
This is what I've changed,
*) Not using oid anymore in the filename
*) New filename/path structure: [-f filename]-split/[schema]/[desc]/[tag].sql
*) If two objects share the same name tag for the same [schema]/[desc], -2, -3, etc is appended to the name. Example:
~/pg.dump-split/public/FUNCTION/foobar.sql
~/pg.dump-split/public/FUNCTION/foobar-2.sql
~/pg.dump-split/public/FUNCTION/barfoo.sql
~/pg.dump-split/public/FUNCTION/barfoo-2.sql
~/pg.dump-split/public/FUNCTION/barfoo-3.sql
I think you are right about functions (and aggregates) being the only desc-type where two objects can share the same name in the same schema.
This means the problem of dumping objects in different order is a very limited problem, only affecting overloaded functions.
I didn't include the arguments in the file name, as it would lead to very long file names unless truncated, and since the problem is very limited, I think we shouldn't include it. It's cleaner with just the name part of the tag in the file name.
--
Best regards,
Joel Jacobson
Glue Finance