From: | Juergen Hannappel <juergen(at)juergen-hannappel(dot)de> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | Juergen Hannappel <juergen(at)juergen-hannappel(dot)de> |
Subject: | [PATCH] add option to pg_dumpall to exclude tables from the dump |
Date: | 2016-04-22 10:42:59 |
Message-ID: | 1461321779-28029-1-git-send-email-juergen@juergen-hannappel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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 <juergen(at)juergen-hannappel(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Rajkumar Raghuwanshi | 2016-04-22 12:44:59 | postgres_fdw : Not able to update foreign table referring to a local table's view when use_remote_estimate = true |
Previous Message | Magnus Hagander | 2016-04-22 09:22:36 | pgsql: Add putenv support for msvcrt from Visual Studio 2013 |