Problems with pg_dump and -t wildcards
I'm having some problems with pg_dump and the -t switch. I can't get it
to work using wildcards nor with multiple -t switches. I'm using
PostgreSQL 8.1.5 and trying to dump just a table and its associated
sequence.
As shown below, the table il_sections and the sequence
il_sections_gid_seq both exist in the database spatial1. But neither
pg_dump -Fc -t 'il_sections*' spatial1 > il_plss.dump
nor
pg_dump -Fc -t il_sections -t il_sections_gid_seq spatial1 > il_plss.dump
will work. The former generates the error listed below while the latter
just creates a tiny file with nothing but a couple of comments in it.
Anyone know what's wrong?
- Bill Thoen
Here's what I get:
$ psql -dspatial1
Welcome to psql 8.1.5, the PostgreSQL interactive terminal.
...
spatial1=# \d
List of relations
Schema | Name | Type | Owner
--------+-----------------------+----------+----------
public | US_States_ogc_fid_seq | sequence | bthoen
public | counties | table | bthoen
public | counties_gid_seq | sequence | bthoen
public | geometry_columns | table | postgres
public | il_sections | table | bthoen
public | il_sections_gid_seq | sequence | bthoen
public | spatial_ref_sys | table | postgres
public | states | table | bthoen
(8 rows)
spatial1=# \q
$ pg_dump -Fc -t 'il_section*' spatial1 > il_plss.dump
pg_dump: specified table "il_section*" does not exist
On Fri, 2008-07-25 at 11:36 -0600, Bill Thoen wrote:
I'm having some problems with pg_dump and the -t switch. I can't get it
to work using wildcards nor with multiple -t switches. I'm using
PostgreSQL 8.1.5 and trying to dump just a table and its associated
sequence.
That is because it doesn't work like that. IIRC you can dump exactly one
table with the -t switch.
Sincerely,
Joshua D. Drake
--
The PostgreSQL Company since 1997: http://www.commandprompt.com/
PostgreSQL Community Conference: http://www.postgresqlconference.org/
United States PostgreSQL Association: http://www.postgresql.us/
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
"Joshua D. Drake" <jd@commandprompt.com> writes:
On Fri, 2008-07-25 at 11:36 -0600, Bill Thoen wrote:
I'm having some problems with pg_dump and the -t switch. I can't get it
to work using wildcards nor with multiple -t switches. I'm using
PostgreSQL 8.1.5 and trying to dump just a table and its associated
sequence.
That is because it doesn't work like that. IIRC you can dump exactly one
table with the -t switch.
-t does take a wildcard pattern ... in 8.2 and later. I don't believe
8.1 handled more than one -t switch, either.
regards, tom lane
On Fri, Jul 25, 2008 at 11:36:14AM -0600, Bill Thoen wrote:
I'm having some problems with pg_dump and the -t switch. I can't get it to
work using wildcards nor with multiple -t switches. I'm using PostgreSQL
8.1.5 and trying to dump just a table and its associated sequence.
You can't do that. The ability to specify multiple -t switches came
in 8.2.
You can work around this if you have a custom dump format, by just
restoring the tables you want using pg_restore. This is a pretty
hideous workaround, though.
A
--
Andrew Sullivan
ajs@commandprompt.com
+1 503 667 4564 x104
http://www.commandprompt.com/
Ah ha! I'm reading the wrong docs. Duh...
I guess it's upgrade time!
Thank you.
Tom Lane wrote:
Show quoted text
"Joshua D. Drake" <jd@commandprompt.com> writes:
On Fri, 2008-07-25 at 11:36 -0600, Bill Thoen wrote:
I'm having some problems with pg_dump and the -t switch. I can't get it
to work using wildcards nor with multiple -t switches. I'm using
PostgreSQL 8.1.5 and trying to dump just a table and its associated
sequence.That is because it doesn't work like that. IIRC you can dump exactly one
table with the -t switch.-t does take a wildcard pattern ... in 8.2 and later. I don't believe
8.1 handled more than one -t switch, either.regards, tom lane