pg_dump schma while excluding specific table

Started by Tony Capobiancoover 14 years ago7 messagesgeneral
Jump to latest
#1Tony Capobianco
tcapobianco@prospectiv.com

When I issue:

pg_dump newdb > /DUMPDIR/newdb.dmp -n dev -T corgi -w -v -F c 2> /DUMPDIR/newdb.log

I get a dump of the entire dev schema. My goal is to dump the dev
schema minus the corgi table. How can I adjust my script to perform
this function?

Thanks.

#2Greg Williamson
gwilliamson39@yahoo.com
In reply to: Tony Capobianco (#1)
Re: pg_dump schma while excluding specific table

Tony --

When I issue:

pg_dump newdb > /DUMPDIR/newdb.dmp -n dev -T corgi -w -v -F c 2>
/DUMPDIR/newdb.log

I get a dump of the entire dev schema.  My goal is to dump the dev
schema minus the corgi table.  How can I adjust my script to perform
this function?

Thanks.

Maybe the order of your arguments is causing some issues. This worked for me

  pg_dump -s -T product_feed_data staging_feed > sf.sql

Where staging_feed is that database and product_feed_data is the table I excluded:
grep product_feed_data sf.sql | grep -v product_feed_data_
COMMENT ON TABLE product_key IS 'A temporary table used to sync product_feed_data.does_exist_in_product.  ...

HTH,

Greg Williamson

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Tony Capobianco (#1)
Re: pg_dump schma while excluding specific table

On Thursday, November 03, 2011 8:16:42 am Tony Capobianco wrote:

When I issue:

pg_dump newdb > /DUMPDIR/newdb.dmp -n dev -T corgi -w -v -F c 2>
/DUMPDIR/newdb.log

I get a dump of the entire dev schema. My goal is to dump the dev
schema minus the corgi table. How can I adjust my script to perform
this function?

A test here worked:
pg_dump -n public -T csv_null -U postgres -Fc -f test.out test

This is for Postgres version 9.0.4, what version are you using?

Thanks.

--
Adrian Klaver
adrian.klaver@gmail.com

#4Tony Capobianco
tcapobianco@prospectiv.com
In reply to: Adrian Klaver (#3)
Re: pg_dump schma while excluding specific table

I'm using 9.0.3. I've tried several permutations of this script and
still I get a dump of the entire schema. The corgi table is still
included when I need it excluded.

Show quoted text

On Thu, 2011-11-03 at 12:02 -0700, Adrian Klaver wrote:

On Thursday, November 03, 2011 8:16:42 am Tony Capobianco wrote:

When I issue:

pg_dump newdb > /DUMPDIR/newdb.dmp -n dev -T corgi -w -v -F c 2>
/DUMPDIR/newdb.log

I get a dump of the entire dev schema. My goal is to dump the dev
schema minus the corgi table. How can I adjust my script to perform
this function?

A test here worked:
pg_dump -n public -T csv_null -U postgres -Fc -f test.out test

This is for Postgres version 9.0.4, what version are you using?

Thanks.

#5Ioana Danes
ioanasoftware@yahoo.ca
In reply to: Adrian Klaver (#3)
Re: pg_dump schma while excluding specific table

pg_dump newdb > /DUMPDIR/newdb.dmp -n dev -T corgi -w -v -F c 2>
/DUMPDIR/newdb.log

Try: -T dev.corgi  instead of -T corgi

#6Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Tony Capobianco (#4)
Re: pg_dump schma while excluding specific table

On Thursday, November 03, 2011 12:54:35 pm Tony Capobianco wrote:

I'm using 9.0.3. I've tried several permutations of this script and
still I get a dump of the entire schema. The corgi table is still
included when I need it excluded.

You may be getting bit by search path issues:

http://www.postgresql.org/docs/9.0/interactive/app-pgdump.html

"Note: The behavior of the -t switch is not entirely upward compatible with
pre-8.2 PostgreSQL versions. Formerly, writing -t tab would dump all tables
named tab, but now it just dumps whichever one is visible in your default search
path. To get the old behavior you can write -t '*.tab'. Also, you must write
something like -t sch.tab to select a table in a particular schema, rather than
the old locution of -n sch -t tab. "

While the above shows -t the same applies to -T.

--
Adrian Klaver
adrian.klaver@gmail.com

#7Tony Capobianco
tcapobianco@prospectiv.com
In reply to: Ioana Danes (#5)
Re: pg_dump schma while excluding specific table

BINGO!

Thanks everyone. That did the trick!

Show quoted text

On Thu, 2011-11-03 at 12:56 -0700, Ioana Danes wrote:

pg_dump newdb > /DUMPDIR/newdb.dmp -n dev -T corgi -w -v -F c 2>
/DUMPDIR/newdb.log

Try: -T dev.corgi instead of -T corgi