Re: Schema version management

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Schema version management
Date: 2012-05-22 00:41:59
Message-ID: 4FBAE0D7.3050808@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05/21/2012 08:25 PM, Joel Jacobson wrote:
> On Tue, May 22, 2012 at 3:30 AM, Daniel Farina<daniel(at)heroku(dot)com> wrote:
>> Thank you, that's very informative. I'd like to reiterate one
>> question, though, which is something like:
>>
>> "How do you feel that the since-committed directory-output/input
>> support in pg_dump/pg_restore could or should influence your patch, if
>> at all?"
> The directory format fulfills a different purpose. The tables are
> split into files, where each file name gets a number. Functions are
> not split into files, they are defined in the table of content file,
> toc.dat.
>
> Example:
>
> joel(at)Joel-Jacobsons-MacBook-Pro ~ $ pg_dump -F d -f /Users/joel/test
> joel(at)Joel-Jacobsons-MacBook-Pro ~ $ ls -la test
> total 24
> drwx------ 5 joel staff 170 May 22 07:16 .
> drwx------+ 130 joel staff 4488 May 22 07:16 ..
> -rw-r--r-- 1 joel staff 38 May 22 07:16 2116.dat.gz
> -rw-r--r-- 1 joel staff 39 May 22 07:16 2117.dat.gz
> -rw-r--r-- 1 joel staff 2265 May 22 07:16 toc.dat
>
> This is a good feature for its purpose, but doesn't provide a solution
> for the schema version management problem.
>
>> It seems like now that there is support for spitting out a bunch of
>> files in a directory for pg_dump that is now going to be supported for
>> a long time that a new feature like yours might be more cohesive if it
>> somehow played with that. I must confess I haven't read the patch in
>> detail, especially if it has been updated, but back then there was no
>> multi-file output mode from pg_dump, and now there is one. My naive
>> understanding is this would be adding a second one as-is, but I wonder
>> if that is strictly necessary to fulfill the use case.
> If one want to reuse the splitting to files-code of the directory
> format, maybe the existing option -F d could be tweaked to output in
> both a a machine-readable format (current way), and also a
> human-friendly tree of files and content (like suggested by my patch).
>
> I wonder what the option would be called then, having two chars
> options is not an option I guess, maybe -F t for "tree" instead of
> "directory", as the -F d option only dumps to a single directory and
> not a tree-structure?

I have a little utility to write out the data in the TOC as separate
files. It works with both a custom format dump, and the toc.dat file
from a directory format or unpacked tar format dump.

It was originally written as a debugging aid, but can be used to some
extent for schema management as well. It's far from complete, but still
might be useful. See <https://github.com/adunstan/DumpToc>

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2012-05-22 00:53:55 How could we make it simple to access the log as a table?
Previous Message Joel Jacobson 2012-05-22 00:25:53 Re: Schema version management