Thread: pg_dump --table=* dumps nothing?

pg_dump --table=* dumps nothing?

From
David Walter
Date:
Using pg_dump version 7.3.4 with the following options
no table data is dumped.

pg_dump -i --table=* --schema-only db
--
-- PostgreSQL database dump
--
--

EOF

The following patch work for the tables in the specified database. The
patch was built from the source for 7.3.2.

I'm not subscribed to the list, so please cc me if you  wish me to see
any comments.

Thanks.


--- pg_dump.c.orig    2003-10-01 09:04:48.000000000 -0400
+++ pg_dump.c    2003-10-01 09:07:11.000000000 -0400
@@ -781,6 +781,16 @@ selectDumpableTable(TableInfo *tbinfo)
      */
     if (tbinfo->relnamespace->dump)
         tbinfo->dump = true;
+   /*
+    * ** selectTablename 'magic' **
+    * '*' == all tables strlen == 0
+    * selectTablename not null
+    * *selectTablename == '\0'
+    * assumes that saying '*'  doesn't include system tables --
+    * unless parent namespace had been specified.
+    */
+    else if (selectTablename != NULL && !strlen(selectTablename) && strncmp(tbinfo->relname, "pg_", 3) != 0)
+        tbinfo->dump = true;
     else if (selectTablename != NULL)
         tbinfo->dump = (strcmp(tbinfo->relname, selectTablename) == 0);
     else

--

pub  1024D/DC92AE30 2002-02-26 David Walter <dwalter@syr.edu>
fingerprint = 50A0 E513 732D 1D0F BD26  C84E A8DD 9D80 DC92 AE30
sub  2048g/51023582 2002-02-26

Re: pg_dump --table=* dumps nothing?

From
Peter Eisentraut
Date:
David Walter writes:

> Using pg_dump version 7.3.4 with the following options
> no table data is dumped.
>
> pg_dump -i --table=* --schema-only db
> --
> -- PostgreSQL database dump
> --

Presumably you don't have any table named "*" in your database.  The
wildcard feature was removed some time ago on purpose.

--
Peter Eisentraut   peter_e@gmx.net


Re: pg_dump --table=* dumps nothing?

From
Tom Lane
Date:
David Walter <dwalter@syr.edu> writes:
> Using pg_dump version 7.3.4 with the following options
> no table data is dumped.

> pg_dump -i --table=* --schema-only db

Current sources interpret this as asking to dump a table named "*".
There was never any support for wildcards in the table parameter,
except for a mistaken comment in pg_dump --help.

I would not mind seeing support for actual pattern matching
(eg "--table=foo*" to select all tables beginning with "foo"),
but I don't see much value in supporting just table=*.  You can
get that result by leaving off the --table switch.

            regards, tom lane