Skip site navigation (1) Skip section navigation (2)

Re: pg_restore --no-post-data and --post-data-only

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Jim Nasby <jim(at)nasby(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_restore --no-post-data and --post-data-only
Date: 2011-08-26 22:23:13
Message-ID: 4E581CD1.2040502@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-hackers

On 08/26/2011 04:46 PM, Jim Nasby wrote:
> On Aug 26, 2011, at 12:15 PM, Andrew Dunstan wrote:
>> I knew there would be some bike-shedding about how we specify these things, which is why I haven't written docs yet.
> While we're debating what shade of yellow to paint the shed...
>
> My actual use case is to be able to be able to "inject" SQL into a SQL-formatted dump either pre- or post-data (I'm on 8.3, so I don't actually dump any data; I'm *mostly* emulating the ability to dump data on just certain tables).
>
> So for what I'm doing, the ideal interface would be a way to tell pg_dump "When you're done dumping all table structures but before you get to any constraints, please run $COMMAND and inject it's output into the dump output." For some of the data obfuscation we're doing it would be easiest if $COMMAND was a perl script instead of SQL, but we could probably convert it.
>
> Of course, many other folks actually need the ability to just spit out specific portions of the dump; I'm hoping we can come up with something that supports both concepts.
>

Well, the Unix approach is to use tools that do one thing well to build 
up more complex tools. Making pg_dump run some external command to 
inject things into the stream seems like the wrong thing given this 
philosophy. Use pg_dump to get the bits you want (pre-data, post-data) 
and sandwich them around whatever else you want. As for getting data 
from just certain tables, I just posted a patch for pg_dump to exclude 
data for certain tables, and we could look at providing a positive as 
well as a negative filter if there is sufficient demand.

cheers

andrew

In response to

Responses

pgsql-hackers by date

Next:From: Alvaro HerreraDate: 2011-08-26 22:28:56
Subject: Re: Removal of useless include references
Previous:From: Tom LaneDate: 2011-08-26 21:11:08
Subject: Re: pg_restore --no-post-data and --post-data-only

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group