Re: Putting restrictions on pg_dump?

From: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>
To: lists(at)benjamindsmith(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Putting restrictions on pg_dump?
Date: 2006-01-06 02:17:38
Message-ID: 43BDD342B.EDCEKG@129.180.47.120
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 5 Jan 2006 09:59:45 -0800, Benjamin Smith <lists(at)benjamindsmith(dot)com> wrote:
> Good ideas, all. but, what about keeping things like check constraints,
> foreign keys, etc?

how about something like
pg_dump -s -t customers dbname >customers.def

> Hmmm... maybe, if I dumped the entire DB schema, with no data, and then looped
> thru the tables, creating a temp table (as you describe) with a funky name
> (such as TABLEaBcDeFgH_U) and then pg_dumping that, and then using a regex to
> rename the table in the output... (eg
>
> /TABLE\s+TABLEaBcDeFgH_U/TABLE customers/
>
> Ugh. I was hoping there was a cleaner way...

Make a script with all the commands in it. You should be able to
manually make a file that is similar to what pg_dump does.

pg_dump -s -t customers dbname >customers.def
echo "copy customers from stdin;" >>customers.def
psql -d dname -c "create temp table dump as select * from customers
where id=11; copy dump to stdout;" >>customers.def
echo "\." >>customers.def

klint.

+---------------------------------------+-----------------+
: Klint Gore : "Non rhyming :
: EMail : kg(at)kgb(dot)une(dot)edu(dot)au : slang - the :
: Snail : A.B.R.I. : possibilities :
: Mail University of New England : are useless" :
: Armidale NSW 2351 Australia : L.J.J. :
: Fax : +61 2 6772 5376 : :
+---------------------------------------+-----------------+

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Fuhr 2006-01-06 02:22:48 Re: copy from error
Previous Message Tom Lane 2006-01-06 00:48:37 Re: NEW variable values in trigger functions