A new option -T --exlude-table for pg_dumpall. This option is then
passed through to the pg_dump which really does the work.
This feature can be used to exclude large tables that are known not
to change from a database backup dump so that only the changing parts
of the database are dumped.

Signed-off-by: Juergen Hannappel <juer...@juergen-hannappel.de>
---
 doc/src/sgml/ref/pg_dumpall.sgml | 14 ++++++++++++++
 src/bin/pg_dump/pg_dumpall.c     |  9 ++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml
index 6c34c25..24408b9 100644
--- a/doc/src/sgml/ref/pg_dumpall.sgml
+++ b/doc/src/sgml/ref/pg_dumpall.sgml
@@ -198,6 +198,20 @@ PostgreSQL documentation
      </varlistentry>
 
      <varlistentry>
+      <term><option>-T <replaceable 
class="parameter">table</replaceable></option></term>
+      <term><option>--exclude-table=<replaceable 
class="parameter">table</replaceable></option></term>
+      <listitem>
+       <para>
+        Do not dump any tables matching the <replaceable
+        class="parameter">table</replaceable> pattern.  The pattern is
+        interpreted according to the same rules as for <option>-t</>.
+        <option>-T</> can be given more than once to exclude tables
+        matching any of several patterns.
+       </para>
+      </listitem>
+     </varlistentry>
+
+     <varlistentry>
       <term><option>-v</></term>
       <term><option>--verbose</></term>
       <listitem>
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index a7dc41c..979a964 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -111,6 +111,7 @@ main(int argc, char *argv[])
                {"password", no_argument, NULL, 'W'},
                {"no-privileges", no_argument, NULL, 'x'},
                {"no-acl", no_argument, NULL, 'x'},
+               {"exclude-table", required_argument, NULL, 'T'},
 
                /*
                 * the following options don't have an equivalent short option 
letter
@@ -195,7 +196,7 @@ main(int argc, char *argv[])
 
        pgdumpopts = createPQExpBuffer();
 
-       while ((c = getopt_long(argc, argv, "acd:f:gh:l:oOp:rsS:tU:vwWx", 
long_options, &optindex)) != -1)
+       while ((c = getopt_long(argc, argv, "acd:f:gh:l:oOp:rsS:tU:vwWxT:", 
long_options, &optindex)) != -1)
        {
                switch (c)
                {
@@ -283,6 +284,11 @@ main(int argc, char *argv[])
                                appendPQExpBufferStr(pgdumpopts, " -x");
                                break;
 
+                       case 'T':
+                               appendPQExpBufferStr(pgdumpopts, " -T");
+                               doShellQuoting(pgdumpopts,optarg);
+                               break;
+
                        case 0:
                                break;
 
@@ -564,6 +570,7 @@ help(void)
        printf(_("  -s, --schema-only            dump only the schema, no 
data\n"));
        printf(_("  -S, --superuser=NAME         superuser user name to use in 
the dump\n"));
        printf(_("  -t, --tablespaces-only       dump only tablespaces, no 
databases or roles\n"));
+       printf(_("  -T, --exclude-table          exclude some tables\n"));
        printf(_("  -x, --no-privileges          do not dump privileges 
(grant/revoke)\n"));
        printf(_("  --binary-upgrade             for use by upgrade utilities 
only\n"));
        printf(_("  --column-inserts             dump data as INSERT commands 
with column names\n"));
-- 
1.8.4.5



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to