[Proposal] Allow pg_dump to include all child tables with the root table
Hi all,
I would like to propose a new pg_dump option called --with-child to
include or exclude from a dump all child and partition tables when a
parent table is specified using option -t/--table or -T/--exclude-table.
The whole tree is dumped with the root table.
To include all partitions or child tables with inheritance in a table
dump we usually use the wildcard, for example:
pg_dump -d mydb -t "root_tbname*" > out.sql
This suppose that all child/partition tables use the prefix root_tbname
in their object name. This is often the case but, if you are as lucky as
me, the partitions could have a total different name. No need to say
that for inheritance this is rarely the case. The other problem is that
with the wildcard you can also dump relations that are not concerned at
all by what you want to dump. Using the --with-child option will allow
to just specify the root relation and all child/partition definitions
and/or data will be parts of dump.
pg_dump -d mydb --table "root_tbname" --with-childs > out.sql
To exclude a whole inheritance tree from a dump:
pg_dump -d mydb --exclude-table "root_tbname" --with-childs > out.sql
Here in attachment the patch that adds this feature to pg_dump.
Is there is any interest for this feature?
Best regards,
--
Gilles Darold
https://www.migops.com/
Attachments:
0001-dump-with-child-v1.patchtext/x-patch; charset=UTF-8; name=0001-dump-with-child-v1.patchDownload
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 2c938cd7e1..f9635442f9 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1172,6 +1172,17 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--with-childs</option></term>
+ <listitem>
+ <para>
+ Include or exclude from a dump all child and partition tables when a parent
+ table is specified using option <option>-t</option>/<option>--table</option>
+ or <option>-T</option>/<option>--exclude-table</option>.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>-?</option></term>
<term><option>--help</option></term>
diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h
index aba780ef4b..09284c82be 100644
--- a/src/bin/pg_dump/pg_backup.h
+++ b/src/bin/pg_dump/pg_backup.h
@@ -200,6 +200,7 @@ typedef struct _dumpOptions
int sequence_data; /* dump sequence data even in schema-only mode */
int do_nothing;
+ bool with_childs;
} DumpOptions;
/*
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 5e800dc79a..83c092080e 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -421,6 +421,7 @@ main(int argc, char **argv)
{"on-conflict-do-nothing", no_argument, &dopt.do_nothing, 1},
{"rows-per-insert", required_argument, NULL, 10},
{"include-foreign-data", required_argument, NULL, 11},
+ {"with-childs", no_argument, NULL, 12},
{NULL, 0, NULL, 0}
};
@@ -631,6 +632,10 @@ main(int argc, char **argv)
optarg);
break;
+ case 12: /* dump child table too */
+ dopt.with_childs = true;
+ break;
+
default:
/* getopt_long already emitted a complaint */
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
@@ -810,6 +815,14 @@ main(int argc, char **argv)
false);
/* non-matching exclusion patterns aren't an error */
+ /*
+ * The include child option require that there is
+ * at least one table inclusion
+ */
+ if (dopt.with_childs && table_include_patterns.head == NULL
+ && table_exclude_patterns.head == NULL)
+ pg_fatal("option --with-childs requires option -t/--table or -T/--exclude-table");
+
/* Expand table selection patterns into OID lists */
if (table_include_patterns.head != NULL)
{
@@ -1088,6 +1101,9 @@ help(const char *progname)
printf(_(" --use-set-session-authorization\n"
" use SET SESSION AUTHORIZATION commands instead of\n"
" ALTER OWNER commands to set ownership\n"));
+ printf(_(" --with-childs include or exclude from a dump all child and partition\n"
+ " tables when a parent table is specified using\n"
+ " -t/--table or -T/--exclude-table\n"));
printf(_("\nConnection options:\n"));
printf(_(" -d, --dbname=DBNAME database to dump\n"));
@@ -1520,6 +1536,15 @@ expand_table_name_patterns(Archive *fout,
PQExpBufferData dbbuf;
int dotcnt;
+ /*
+ * With --include_child we look recursively to the inheritance
+ * tree to find the childs tables of the matching include filter
+ */
+ if (fout->dopt->with_childs)
+ {
+ appendPQExpBuffer(query, "WITH RECURSIVE child_tree (relid) AS (\n");
+ }
+
/*
* Query must remain ABSOLUTELY devoid of unqualified names. This
* would be unnecessary given a pg_table_is_visible() variant taking a
@@ -1547,6 +1572,20 @@ expand_table_name_patterns(Archive *fout,
prohibit_crossdb_refs(GetConnection(fout), dbbuf.data, cell->val);
termPQExpBuffer(&dbbuf);
+ if (fout->dopt->with_childs)
+ {
+ appendPQExpBuffer(query, "\n UNION ALL"
+ "\n SELECT c.oid AS relid"
+ "\n FROM child_tree AS p"
+ "\n JOIN pg_catalog.pg_inherits AS i"
+ "\n ON (p.relid OPERATOR(pg_catalog.=) i.inhparent)"
+ "\n JOIN pg_catalog.pg_class AS c"
+ "\n ON (c.oid OPERATOR(pg_catalog.=) i.inhrelid)"
+ "\n)"
+ "\nSELECT relid FROM child_tree");
+
+ }
+
ExecuteSqlStatement(fout, "RESET search_path");
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
PQclear(ExecuteSqlQueryForSingleRow(fout,
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 2eeef2a478..6f4ecc4210 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -319,6 +319,17 @@ my %pgdump_runs = (
'--exclude-table=dump_test.test_table', 'postgres',
],
},
+ exclude_child_table => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ '--with-childs',
+ "--file=$tempdir/exclude_child_table.sql",
+ '--exclude-table=dump_test.measurement',
+ 'postgres',
+ ],
+ },
+
exclude_test_table_data => {
dump_cmd => [
'pg_dump',
@@ -413,6 +424,18 @@ my %pgdump_runs = (
'postgres',
],
},
+ include_child_table => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ '--with-childs',
+ "--file=$tempdir/include_child_table.sql",
+ '--table=dump_test.measurement',
+ '--lock-wait-timeout='
+ . (1000 * $PostgreSQL::Test::Utils::timeout_default),
+ 'postgres',
+ ],
+ },
role => {
dump_cmd => [
'pg_dump',
@@ -541,6 +564,7 @@ my %full_runs = (
compression => 1,
createdb => 1,
defaults => 1,
+ exclude_child_table => 1,
exclude_dump_test_schema => 1,
exclude_test_table => 1,
exclude_test_table_data => 1,
@@ -936,6 +960,10 @@ my %tests = (
role => 1,
section_pre_data => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -1025,11 +1053,16 @@ my %tests = (
'ALTER TABLE measurement OWNER TO' => {
regexp => qr/^\QALTER TABLE dump_test.measurement OWNER TO \E.+;/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ include_child_table => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ exclude_child_table => 1,
},
},
@@ -1040,8 +1073,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ no_owner => 1,
+ exclude_child_table => 1,
},
- unlike => { no_owner => 1, },
},
'ALTER FOREIGN TABLE foreign_table OWNER TO' => {
@@ -2793,11 +2830,16 @@ my %tests = (
\)\n
\QPARTITION BY RANGE (logdate);\E\n
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ include_child_table => 1,
+ },
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ exclude_child_table => 1,
},
},
@@ -2824,6 +2866,10 @@ my %tests = (
section_pre_data => 1,
role => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -2838,10 +2884,14 @@ my %tests = (
\QEXECUTE FUNCTION dump_test.trigger_func();\E
/xm,
like => {
- %full_runs, %dump_test_schema_runs, section_post_data => 1,
+ %full_runs,
+ %dump_test_schema_runs,
+ section_post_data => 1,
+ include_child_table => 1,
},
unlike => {
exclude_dump_test_schema => 1,
+ exclude_child_table => 1,
},
},
@@ -2869,6 +2919,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -2881,6 +2935,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -2893,6 +2951,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -3250,6 +3312,7 @@ my %tests = (
schema_only => 1,
section_post_data => 1,
test_schema_plus_large_objects => 1,
+ include_child_table => 1,
},
unlike => {
exclude_dump_test_schema => 1,
@@ -3258,6 +3321,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
role => 1,
section_pre_data => 1,
+ exclude_child_table => 1,
},
},
@@ -3271,9 +3335,16 @@ my %tests = (
\QALTER TABLE ONLY dump_test.measurement\E \n^\s+
\QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_post_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ exclude_child_table => 1,
+ },
},
'CREATE INDEX ... ON measurement_y2006_m2' => {
@@ -3284,6 +3355,10 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -3295,6 +3370,10 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -3324,6 +3403,7 @@ my %tests = (
role => 1,
schema_only => 1,
section_post_data => 1,
+ include_child_table => 1,
},
unlike => {
only_dump_test_schema => 1,
@@ -3332,6 +3412,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
section_pre_data => 1,
test_schema_plus_large_objects => 1,
+ exclude_child_table => 1,
},
},
@@ -3614,11 +3695,16 @@ my %tests = (
TO regress_dump_test_role;',
regexp =>
qr/^\QGRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;\E/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ include_child_table => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ exclude_child_table => 1,
},
},
@@ -3636,8 +3722,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ no_privs => 1,
+ exclude_child_table => 1,
},
- unlike => { no_privs => 1, },
},
'GRANT ALL ON LARGE OBJECT ...' => {
@@ -3884,6 +3974,7 @@ my %tests = (
only_dump_test_table => 1,
role => 1,
section_pre_data => 1,
+ include_child_table => 1,
},
unlike => { no_privs => 1, },
},
@@ -4106,6 +4197,13 @@ $node->command_fails_like(
qr/pg_dumpall: error: improper qualified name \(too many dotted names\): myhost\.mydb/,
'pg_dumpall: option --exclude-database rejects multipart database names');
+#########################################
+# Test invalid use of --with-childs
+$node->command_fails_like(
+ [ 'pg_dump', '-p', "$port", '--with-childs' ],
+ qr/pg_dump: error: option --with-childs requires option -t\/--table or -T\/--exclude-table/,
+ 'pg_dump: option --with-childs require inclusion or exclusion of tables');
+
#########################################
# Test valid database exclusion patterns
The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: not tested
Documentation: not tested
Hi
the patch applies fine on current master branch and it works as described. However, I would suggest changing the new option name from "--with-childs" to "--with-partitions" for several reasons.
"childs" is grammatically incorrect and in the PG community, the term "partitioned table" is normally used to denote a parent table, and the term "partition" is used to denote the child table under the parent table. We should use these terms to stay consistent with the community.
Also, I would rephrase the documentation as:
Used in conjunction with <option>-t</option>/<option>--table</option> or <option>-T</option>/<option>--exclude-table</option> options to include or exclude partitions of the specified tables if any.
thank you
Cary Huang
================
HighGo Software Canada
www.highgo.ca
Hi,
I'm not sure about the "child" -> "partition" change as it also selects
childs that are not partitions.
I'm more dubious about the --with-childs option, I'd rather have
--table-with-childs=<PATTERN> and --exclude-table-with-childs=<PATTERN>.
That will be clearer about what is what.
I'm working on that, but have a hard time with test pg_dump/002_pg_dump
(It's brand new to me)
Stéphane
Le ven. 24 févr. 2023 à 23:50, Cary Huang <cary.huang@highgo.ca> a écrit :
The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: not tested
Documentation: not testedHi
the patch applies fine on current master branch and it works as described.
However, I would suggest changing the new option name from "--with-childs"
to "--with-partitions" for several reasons."childs" is grammatically incorrect and in the PG community, the term
"partitioned table" is normally used to denote a parent table, and the term
"partition" is used to denote the child table under the parent table. We
should use these terms to stay consistent with the community.Also, I would rephrase the documentation as:
Used in conjunction with <option>-t</option>/<option>--table</option> or
<option>-T</option>/<option>--exclude-table</option> options to include or
exclude partitions of the specified tables if any.thank you
Cary Huang
================
HighGo Software Canada
www.highgo.ca
--
"Où se posaient les hirondelles avant l'invention du téléphone ?"
-- Grégoire Lacroix
Le 25/02/2023 à 16:40, Stéphane Tachoires a écrit :
Hi,
I'm not sure about the "child" -> "partition" change as it also
selects childs that are not partitions.
I'm more dubious about the --with-childs option, I'd rather have
--table-with-childs=<PATTERN> and
--exclude-table-with-childs=<PATTERN>. That will be clearer about what
is what.I'm working on that, but have a hard time with
test pg_dump/002_pg_dump (It's brand new to me)Stéphane
Le ven. 24 févr. 2023 à 23:50, Cary Huang <cary.huang@highgo.ca> a écrit :
The following review has been posted through the commitfest
application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: not tested
Documentation: not testedHi
the patch applies fine on current master branch and it works as
described. However, I would suggest changing the new option name
from "--with-childs" to "--with-partitions" for several reasons."childs" is grammatically incorrect and in the PG community, the
term "partitioned table" is normally used to denote a parent
table, and the term "partition" is used to denote the child table
under the parent table. We should use these terms to stay
consistent with the community.Also, I would rephrase the documentation as:
Used in conjunction with
<option>-t</option>/<option>--table</option> or
<option>-T</option>/<option>--exclude-table</option> options to
include or exclude partitions of the specified tables if any.thank you
Cary Huang
================
HighGo Software Canada
www.highgo.ca <http://www.highgo.ca>
Hi,
This is right this patch also works with inherited tables so
--with-partitions can be confusing this is why --with-childs was chosen.
But I disagree the use of --table-with-childs and
--exclude-table-with-childs because we already have the --table and
--exclude-table, and it will add lot of code where we just need a switch
to include children tables. Actually my first though was that this
behavior (dump child tables when the root table is dumped using --table)
should be the default in pg_dump but the problem is that it could break
existing scripts using pg_dump so I prefer to implement the
--with-childs options.
I think we can use --with-partitions, provided that it is clear in the
documentation that this option also works with inheritance.
Attached is a new patch v2 using the --with-partitions and the
documentation fix.
--
Gilles Darold
Attachments:
0001-dump-with-child-v2.patchtext/x-patch; charset=UTF-8; name=0001-dump-with-child-v2.patchDownload
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 49d218905f..15ada5c8ee 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -1173,6 +1173,18 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--with-partitions</option></term>
+ <listitem>
+ <para>
+ Used in conjunction with <option>-t</option>/<option>--table</option>
+ or <option>-T</option>/<option>--exclude-table</option> options to
+ include or exclude partitions of the specified tables if any.
+ This option is also valid for tables using inheritance.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>-?</option></term>
<term><option>--help</option></term>
diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h
index aba780ef4b..2e7e919391 100644
--- a/src/bin/pg_dump/pg_backup.h
+++ b/src/bin/pg_dump/pg_backup.h
@@ -200,6 +200,7 @@ typedef struct _dumpOptions
int sequence_data; /* dump sequence data even in schema-only mode */
int do_nothing;
+ bool with_partitions;
} DumpOptions;
/*
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 24ba936332..2b7a122d7e 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -421,6 +421,7 @@ main(int argc, char **argv)
{"on-conflict-do-nothing", no_argument, &dopt.do_nothing, 1},
{"rows-per-insert", required_argument, NULL, 10},
{"include-foreign-data", required_argument, NULL, 11},
+ {"with-partitions", no_argument, NULL, 12},
{NULL, 0, NULL, 0}
};
@@ -631,6 +632,10 @@ main(int argc, char **argv)
optarg);
break;
+ case 12: /* dump child table too */
+ dopt.with_partitions = true;
+ break;
+
default:
/* getopt_long already emitted a complaint */
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
@@ -809,6 +814,14 @@ main(int argc, char **argv)
false);
/* non-matching exclusion patterns aren't an error */
+ /*
+ * The include child option require that there is
+ * at least one table inclusion
+ */
+ if (dopt.with_partitions && table_include_patterns.head == NULL
+ && table_exclude_patterns.head == NULL)
+ pg_fatal("option --with-partitions requires option -t/--table or -T/--exclude-table");
+
/* Expand table selection patterns into OID lists */
if (table_include_patterns.head != NULL)
{
@@ -1087,6 +1100,9 @@ help(const char *progname)
printf(_(" --use-set-session-authorization\n"
" use SET SESSION AUTHORIZATION commands instead of\n"
" ALTER OWNER commands to set ownership\n"));
+ printf(_(" --with-partitons include or exclude from a dump all child and partition\n"
+ " tables when a parent table is specified using\n"
+ " -t/--table or -T/--exclude-table\n"));
printf(_("\nConnection options:\n"));
printf(_(" -d, --dbname=DBNAME database to dump\n"));
@@ -1519,6 +1535,15 @@ expand_table_name_patterns(Archive *fout,
PQExpBufferData dbbuf;
int dotcnt;
+ /*
+ * With --include_child we look recursively to the inheritance
+ * tree to find the partitions tables of the matching include filter
+ */
+ if (fout->dopt->with_partitions)
+ {
+ appendPQExpBuffer(query, "WITH RECURSIVE partition_tree (relid) AS (\n");
+ }
+
/*
* Query must remain ABSOLUTELY devoid of unqualified names. This
* would be unnecessary given a pg_table_is_visible() variant taking a
@@ -1546,6 +1571,20 @@ expand_table_name_patterns(Archive *fout,
prohibit_crossdb_refs(GetConnection(fout), dbbuf.data, cell->val);
termPQExpBuffer(&dbbuf);
+ if (fout->dopt->with_partitions)
+ {
+ appendPQExpBuffer(query, "\n UNION ALL"
+ "\n SELECT c.oid AS relid"
+ "\n FROM partition_tree AS p"
+ "\n JOIN pg_catalog.pg_inherits AS i"
+ "\n ON (p.relid OPERATOR(pg_catalog.=) i.inhparent)"
+ "\n JOIN pg_catalog.pg_class AS c"
+ "\n ON (c.oid OPERATOR(pg_catalog.=) i.inhrelid)"
+ "\n)"
+ "\nSELECT relid FROM partition_tree");
+
+ }
+
ExecuteSqlStatement(fout, "RESET search_path");
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
PQclear(ExecuteSqlQueryForSingleRow(fout,
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 72b19ee6cd..c744ddbbd2 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -393,6 +393,17 @@ my %pgdump_runs = (
'--exclude-table=dump_test.test_table', 'postgres',
],
},
+ exclude_child_table => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ '--with-partitions',
+ "--file=$tempdir/exclude_child_table.sql",
+ '--exclude-table=dump_test.measurement',
+ 'postgres',
+ ],
+ },
+
exclude_test_table_data => {
dump_cmd => [
'pg_dump',
@@ -487,6 +498,18 @@ my %pgdump_runs = (
'postgres',
],
},
+ include_child_table => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ '--with-partitions',
+ "--file=$tempdir/include_child_table.sql",
+ '--table=dump_test.measurement',
+ '--lock-wait-timeout='
+ . (1000 * $PostgreSQL::Test::Utils::timeout_default),
+ 'postgres',
+ ],
+ },
role => {
dump_cmd => [
'pg_dump',
@@ -615,6 +638,7 @@ my %full_runs = (
compression => 1,
createdb => 1,
defaults => 1,
+ exclude_child_table => 1,
exclude_dump_test_schema => 1,
exclude_test_table => 1,
exclude_test_table_data => 1,
@@ -1010,6 +1034,10 @@ my %tests = (
role => 1,
section_pre_data => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -1099,11 +1127,16 @@ my %tests = (
'ALTER TABLE measurement OWNER TO' => {
regexp => qr/^\QALTER TABLE dump_test.measurement OWNER TO \E.+;/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ include_child_table => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ exclude_child_table => 1,
},
},
@@ -1114,8 +1147,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ no_owner => 1,
+ exclude_child_table => 1,
},
- unlike => { no_owner => 1, },
},
'ALTER FOREIGN TABLE foreign_table OWNER TO' => {
@@ -2867,11 +2904,16 @@ my %tests = (
\)\n
\QPARTITION BY RANGE (logdate);\E\n
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ include_child_table => 1,
+ },
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ exclude_child_table => 1,
},
},
@@ -2898,6 +2940,10 @@ my %tests = (
section_pre_data => 1,
role => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -2912,10 +2958,14 @@ my %tests = (
\QEXECUTE FUNCTION dump_test.trigger_func();\E
/xm,
like => {
- %full_runs, %dump_test_schema_runs, section_post_data => 1,
+ %full_runs,
+ %dump_test_schema_runs,
+ section_post_data => 1,
+ include_child_table => 1,
},
unlike => {
exclude_dump_test_schema => 1,
+ exclude_child_table => 1,
},
},
@@ -2943,6 +2993,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -2955,6 +3009,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -2967,6 +3025,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -3324,6 +3386,7 @@ my %tests = (
schema_only => 1,
section_post_data => 1,
test_schema_plus_large_objects => 1,
+ include_child_table => 1,
},
unlike => {
exclude_dump_test_schema => 1,
@@ -3332,6 +3395,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
role => 1,
section_pre_data => 1,
+ exclude_child_table => 1,
},
},
@@ -3345,9 +3409,16 @@ my %tests = (
\QALTER TABLE ONLY dump_test.measurement\E \n^\s+
\QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_post_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ exclude_child_table => 1,
+ },
},
'CREATE INDEX ... ON measurement_y2006_m2' => {
@@ -3358,6 +3429,10 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -3369,6 +3444,10 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ exclude_child_table => 1,
},
},
@@ -3398,6 +3477,7 @@ my %tests = (
role => 1,
schema_only => 1,
section_post_data => 1,
+ include_child_table => 1,
},
unlike => {
only_dump_test_schema => 1,
@@ -3406,6 +3486,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
section_pre_data => 1,
test_schema_plus_large_objects => 1,
+ exclude_child_table => 1,
},
},
@@ -3688,11 +3769,16 @@ my %tests = (
TO regress_dump_test_role;',
regexp =>
qr/^\QGRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;\E/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ include_child_table => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ exclude_child_table => 1,
},
},
@@ -3710,8 +3796,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ include_child_table => 1,
+ },
+ unlike => {
+ no_privs => 1,
+ exclude_child_table => 1,
},
- unlike => { no_privs => 1, },
},
'GRANT ALL ON LARGE OBJECT ...' => {
@@ -3958,6 +4048,7 @@ my %tests = (
only_dump_test_table => 1,
role => 1,
section_pre_data => 1,
+ include_child_table => 1,
},
unlike => { no_privs => 1, },
},
@@ -4180,6 +4271,13 @@ $node->command_fails_like(
qr/pg_dumpall: error: improper qualified name \(too many dotted names\): myhost\.mydb/,
'pg_dumpall: option --exclude-database rejects multipart database names');
+#########################################
+# Test invalid use of --with-partitions
+$node->command_fails_like(
+ [ 'pg_dump', '-p', "$port", '--with-partitions' ],
+ qr/pg_dump: error: option --with-partitions requires option -t\/--table or -T\/--exclude-table/,
+ 'pg_dump: option --with-partitions require inclusion or exclusion of tables');
+
#########################################
# Test valid database exclusion patterns
Gilles Darold <gilles@migops.com> writes:
But I disagree the use of --table-with-childs and
--exclude-table-with-childs because we already have the --table and
--exclude-table, and it will add lot of code where we just need a switch
to include children tables.
I quite dislike the idea of a separate --with-whatever switch, because
it will (presumably) apply to all of your --table and --exclude-table
switches, where you may need it to apply to just some of them.
Spelling considerations aside, attaching the property to the
individual switches seems far superior. And I neither believe that
this would add a lot of code, nor accept that as an excuse even if
it's true.
As noted, "childs" is bad English and "partitions" is flat out wrong
(unless you change it to recurse only to partitions, which doesn't
seem like a better definition). We could go with
--[exclude-]table-and-children, or maybe
--[exclude-]table-and-child-tables, but those are getting into
carpal-tunnel-syndrome-inducing territory :-(. I lack a better
naming suggestion offhand.
regards, tom lane
Le 04/03/2023 à 19:18, Tom Lane a écrit :
Gilles Darold <gilles@migops.com> writes:
But I disagree the use of --table-with-childs and
--exclude-table-with-childs because we already have the --table and
--exclude-table, and it will add lot of code where we just need a switch
to include children tables.I quite dislike the idea of a separate --with-whatever switch, because
it will (presumably) apply to all of your --table and --exclude-table
switches, where you may need it to apply to just some of them.
Spelling considerations aside, attaching the property to the
individual switches seems far superior. And I neither believe that
this would add a lot of code, nor accept that as an excuse even if
it's true.y..
Right, this is not a lot of code but just more code where I think we
just need a switch. I much prefer that it applies to all --table /
--exclude-table because this is generally the behavior we want for all
root/parent tables. But I agree that in some cases users could want that
this behavior applies to some selected tables only so the proposed new
options can answer to this need. Even if generally in similar cases
several pg_dump commands can be used. This is just my opinion, I will
adapt the patch to use the proposed new options.
But, what do you think about having pg_dump default to dump children
tables with --table / --exclude-table? I was very surprised that this
was not the case the first time I see that. In this case we could add
--[exclude-]table-no-child-tables. I think this form will be less used
than the form where we need the child tables to be dump with the parent
table, meaning that most of the time pg_dump commands using --table and
--exclude-table will be kept untouched and those using more regexp to
dump child tables could be simplified. I'm not sure that the backward
compatibility is an argument here to not change the default behavior of
pg_dump.
--
Gilles
--
Gilles Darold
Le 04/03/2023 à 20:18, Tom Lane a écrit :
As noted, "childs" is bad English and "partitions" is flat out wrong
(unless you change it to recurse only to partitions, which doesn't
seem like a better definition). We could go with
--[exclude-]table-and-children, or maybe
--[exclude-]table-and-child-tables, but those are getting into
carpal-tunnel-syndrome-inducing territory 🙁. I lack a better
naming suggestion offhand.
In attachment is version 3 of the patch, it includes the use of options
suggested by Stephane and Tom:
--table-and-children,
--exclude-table-and-children
--exclude-table-data-and-children.
Documentation have been updated too.
Thanks
--
Gilles Darold
Attachments:
0001-dump-with-child-v3.patchtext/x-patch; charset=UTF-8; name=0001-dump-with-child-v3.patchDownload
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 334e4b7fd1..e97b73194e 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -775,6 +775,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--exclude-table-and-children=<replaceable class="parameter">pattern</replaceable></option></term>
+ <listitem>
+ <para>
+ Same as <option>-T</option>/<option>--exclude-table</option> option but automatically
+ exclude partitions or child tables of the specified tables if any.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>--exclude-table-data=<replaceable class="parameter">pattern</replaceable></option></term>
<listitem>
@@ -793,6 +803,17 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--exclude-table-data-and-children=<replaceable class="parameter">pattern</replaceable></option></term>
+ <listitem>
+ <para>
+ Same as <option>--exclude-table-data</option> but automatically
+ exclude partitions or child tables of the specified tables if any.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
<varlistentry>
<term><option>--extra-float-digits=<replaceable class="parameter">ndigits</replaceable></option></term>
<listitem>
@@ -1158,6 +1179,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--table-with-children=<replaceable class="parameter">pattern</replaceable></option></term>
+ <listitem>
+ <para>
+ Same as <option>-t</option>/<option>--table</option> option but automatically
+ include partitions or child tables of the specified tables if any.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>--use-set-session-authorization</option></term>
<listitem>
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 4217908f84..09d37991d6 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -130,6 +130,10 @@ static SimpleOidList foreign_servers_include_oids = {NULL, NULL};
static SimpleStringList extension_include_patterns = {NULL, NULL};
static SimpleOidList extension_include_oids = {NULL, NULL};
+static SimpleStringList table_include_patterns_and_children = {NULL, NULL};
+static SimpleStringList table_exclude_patterns_and_children = {NULL, NULL};
+static SimpleStringList tabledata_exclude_patterns_and_children = {NULL, NULL};
+
static const CatalogId nilCatalogId = {0, 0};
/* override for standard extra_float_digits setting */
@@ -180,7 +184,8 @@ static void expand_foreign_server_name_patterns(Archive *fout,
static void expand_table_name_patterns(Archive *fout,
SimpleStringList *patterns,
SimpleOidList *oids,
- bool strict_names);
+ bool strict_names,
+ bool with_child_tables);
static void prohibit_crossdb_refs(PGconn *conn, const char *dbname,
const char *pattern);
@@ -421,6 +426,9 @@ main(int argc, char **argv)
{"on-conflict-do-nothing", no_argument, &dopt.do_nothing, 1},
{"rows-per-insert", required_argument, NULL, 10},
{"include-foreign-data", required_argument, NULL, 11},
+ {"table-and-children", required_argument, NULL, 12},
+ {"exclude-table-and-children", required_argument, NULL, 13},
+ {"exclude-table-data-and-children", required_argument, NULL, 14},
{NULL, 0, NULL, 0}
};
@@ -631,6 +639,19 @@ main(int argc, char **argv)
optarg);
break;
+ case 12: /* include table(s) with children */
+ simple_string_list_append(&table_include_patterns_and_children, optarg);
+ dopt.include_everything = false;
+ break;
+
+ case 13: /* exclude table(s) with children */
+ simple_string_list_append(&table_exclude_patterns_and_children, optarg);
+ break;
+
+ case 14: /* exclude table(s) data */
+ simple_string_list_append(&tabledata_exclude_patterns_and_children, optarg);
+ break;
+
default:
/* getopt_long already emitted a complaint */
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
@@ -814,17 +835,34 @@ main(int argc, char **argv)
{
expand_table_name_patterns(fout, &table_include_patterns,
&table_include_oids,
- strict_names);
+ strict_names, false);
if (table_include_oids.head == NULL)
pg_fatal("no matching tables were found");
}
expand_table_name_patterns(fout, &table_exclude_patterns,
&table_exclude_oids,
- false);
+ false, false);
expand_table_name_patterns(fout, &tabledata_exclude_patterns,
&tabledata_exclude_oids,
- false);
+ false, false);
+
+ /* Expand table and children selection patterns into OID lists */
+ if (table_include_patterns_and_children.head != NULL)
+ {
+ expand_table_name_patterns(fout, &table_include_patterns_and_children,
+ &table_include_oids,
+ strict_names, true);
+ if (table_include_oids.head == NULL)
+ pg_fatal("no matching tables were found");
+ }
+ expand_table_name_patterns(fout, &table_exclude_patterns_and_children,
+ &table_exclude_oids,
+ false, true);
+
+ expand_table_name_patterns(fout, &tabledata_exclude_patterns_and_children,
+ &tabledata_exclude_oids,
+ false, true);
expand_foreign_server_name_patterns(fout, &foreign_servers_include_patterns,
&foreign_servers_include_oids);
@@ -1060,7 +1098,11 @@ help(const char *progname)
printf(_(" --disable-triggers disable triggers during data-only restore\n"));
printf(_(" --enable-row-security enable row security (dump only content user has\n"
" access to)\n"));
+ printf(_(" --exclude-table-and-children=PATTERN do NOT dump the specified table(s) including\n"
+ " child and partition tables\n"));
printf(_(" --exclude-table-data=PATTERN do NOT dump data for the specified table(s)\n"));
+ printf(_(" --exclude-table-data-and-children=PATTERN do NOT dump data for the specified\n"
+ " table(s) including child and partition tables\n"));
printf(_(" --extra-float-digits=NUM override default setting for extra_float_digits\n"));
printf(_(" --if-exists use IF EXISTS when dropping objects\n"));
printf(_(" --include-foreign-data=PATTERN\n"
@@ -1084,6 +1126,8 @@ help(const char *progname)
printf(_(" --snapshot=SNAPSHOT use given snapshot for the dump\n"));
printf(_(" --strict-names require table and/or schema include patterns to\n"
" match at least one entity each\n"));
+ printf(_(" --table-and-children=PATTERN dump the specified table(s) only including child\n"
+ " and partition tables\n"));
printf(_(" --use-set-session-authorization\n"
" use SET SESSION AUTHORIZATION commands instead of\n"
" ALTER OWNER commands to set ownership\n"));
@@ -1497,7 +1541,7 @@ expand_foreign_server_name_patterns(Archive *fout,
static void
expand_table_name_patterns(Archive *fout,
SimpleStringList *patterns, SimpleOidList *oids,
- bool strict_names)
+ bool strict_names, bool with_child_tables)
{
PQExpBuffer query;
PGresult *res;
@@ -1519,6 +1563,15 @@ expand_table_name_patterns(Archive *fout,
PQExpBufferData dbbuf;
int dotcnt;
+ /*
+ * With --include_child we look recursively to the inheritance
+ * tree to find the partitions tables of the matching include filter
+ */
+ if (with_child_tables)
+ {
+ appendPQExpBuffer(query, "WITH RECURSIVE partition_tree (relid) AS (\n");
+ }
+
/*
* Query must remain ABSOLUTELY devoid of unqualified names. This
* would be unnecessary given a pg_table_is_visible() variant taking a
@@ -1546,6 +1599,20 @@ expand_table_name_patterns(Archive *fout,
prohibit_crossdb_refs(GetConnection(fout), dbbuf.data, cell->val);
termPQExpBuffer(&dbbuf);
+ if (with_child_tables)
+ {
+ appendPQExpBuffer(query, "\n UNION ALL"
+ "\n SELECT c.oid AS relid"
+ "\n FROM partition_tree AS p"
+ "\n JOIN pg_catalog.pg_inherits AS i"
+ "\n ON (p.relid OPERATOR(pg_catalog.=) i.inhparent)"
+ "\n JOIN pg_catalog.pg_class AS c"
+ "\n ON (c.oid OPERATOR(pg_catalog.=) i.inhrelid)"
+ "\n)"
+ "\nSELECT relid FROM partition_tree");
+
+ }
+
ExecuteSqlStatement(fout, "RESET search_path");
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
PQclear(ExecuteSqlQueryForSingleRow(fout,
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 9c354213ce..c9fc015928 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -393,6 +393,24 @@ my %pgdump_runs = (
'--exclude-table=dump_test.test_table', 'postgres',
],
},
+ exclude_measurement => {
+ dump_cmd => [
+ 'pg_dump', '--no-sync',
+ "--file=$tempdir/exclude_measurement.sql",
+ '--exclude-table-and-children=dump_test.measurement',
+ 'postgres',
+ ],
+ },
+ exclude_measurement_data => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ "--file=$tempdir/exclude_measurement_data.sql",
+ '--exclude-table-data-and-children=dump_test.measurement',
+ '--no-unlogged-table-data',
+ 'postgres',
+ ],
+ },
exclude_test_table_data => {
dump_cmd => [
'pg_dump',
@@ -487,6 +505,17 @@ my %pgdump_runs = (
'postgres',
],
},
+ only_dump_measurement => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ "--file=$tempdir/only_dump_measurement.sql",
+ '--table-and-children=dump_test.measurement',
+ '--lock-wait-timeout='
+ . (1000 * $PostgreSQL::Test::Utils::timeout_default),
+ 'postgres',
+ ],
+ },
role => {
dump_cmd => [
'pg_dump',
@@ -604,6 +633,7 @@ my %pgdump_runs = (
# Tests which target the 'dump_test' schema, specifically.
my %dump_test_schema_runs = (
only_dump_test_schema => 1,
+ only_dump_measurement => 1,
test_schema_plus_large_objects => 1,);
# Tests which are considered 'full' dumps by pg_dump, but there
@@ -618,6 +648,8 @@ my %full_runs = (
exclude_dump_test_schema => 1,
exclude_test_table => 1,
exclude_test_table_data => 1,
+ exclude_measurement => 1,
+ exclude_measurement_data => 1,
no_toast_compression => 1,
no_large_objects => 1,
no_owner => 1,
@@ -644,6 +676,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -663,6 +696,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -741,6 +775,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -754,6 +789,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -786,7 +822,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER OPERATOR CLASS dump_test.op_class OWNER TO' => {
@@ -799,6 +838,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -838,6 +878,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -884,6 +925,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -901,6 +943,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -920,6 +963,7 @@ my %tests = (
},
unlike => {
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -939,6 +983,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -958,6 +1003,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -977,6 +1023,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -996,6 +1043,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1010,6 +1058,10 @@ my %tests = (
role => 1,
section_pre_data => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -1029,6 +1081,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1050,7 +1103,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER TABLE test_table OWNER TO' => {
@@ -1064,6 +1120,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
no_owner => 1,
},
},
@@ -1083,6 +1140,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1094,16 +1152,22 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
'ALTER TABLE measurement OWNER TO' => {
regexp => qr/^\QALTER TABLE dump_test.measurement OWNER TO \E.+;/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ exclude_measurement => 1,
},
},
@@ -1114,8 +1178,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ no_owner => 1,
+ exclude_measurement => 1,
},
- unlike => { no_owner => 1, },
},
'ALTER FOREIGN TABLE foreign_table OWNER TO' => {
@@ -1126,6 +1194,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -1137,6 +1206,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -1150,6 +1220,7 @@ my %tests = (
only_dump_test_table => 1,
no_owner => 1,
role => 1,
+ only_dump_measurement => 1,
},
},
@@ -1240,6 +1311,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1259,6 +1331,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1271,7 +1344,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON COLUMN dump_test.test_second_table.col1' => {
@@ -1283,7 +1359,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON COLUMN dump_test.test_second_table.col2' => {
@@ -1295,7 +1374,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON CONVERSION dump_test.test_conversion' => {
@@ -1306,7 +1388,10 @@ my %tests = (
qr/^\QCOMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversion';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON COLLATION test0' => {
@@ -1372,7 +1457,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 IS 'comment on text search configuration';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => {
@@ -1384,7 +1472,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 IS 'comment on text search dictionary';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1' => {
@@ -1395,7 +1486,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 IS 'comment on text search parser';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => {
@@ -1406,7 +1500,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text search template';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.planets - ENUM' => {
@@ -1417,7 +1514,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.planets IS 'comment on enum type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.textrange - RANGE' => {
@@ -1428,7 +1528,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.textrange IS 'comment on range type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.int42 - Regular' => {
@@ -1439,7 +1542,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.int42 IS 'comment on regular type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.undefined - Undefined' => {
@@ -1450,7 +1556,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COPY test_table' => {
@@ -1474,6 +1583,7 @@ my %tests = (
exclude_test_table => 1,
exclude_test_table_data => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1497,6 +1607,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1532,6 +1643,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1553,6 +1665,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1575,6 +1688,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1596,6 +1710,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1617,6 +1732,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1796,7 +1912,10 @@ my %tests = (
exclude_test_table => 1,
section_pre_data => 1,
},
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE CONVERSION dump_test.test_conversion' => {
@@ -1807,7 +1926,10 @@ my %tests = (
qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE DOMAIN dump_test.us_postal_code' => {
@@ -1829,7 +1951,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.pltestlang_call_handler' => {
@@ -1846,7 +1971,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.trigger_func' => {
@@ -1862,7 +1990,10 @@ my %tests = (
\$\$;/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.event_trigger_func' => {
@@ -1878,7 +2009,10 @@ my %tests = (
\$\$;/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE OPERATOR FAMILY dump_test.op_family' => {
@@ -1890,7 +2024,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE OPERATOR CLASS dump_test.op_class' => {
@@ -1920,7 +2057,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
# verify that a custom operator/opclass/range type is dumped in right order
@@ -1950,7 +2090,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE OPERATOR CLASS dump_test.op_class_empty' => {
@@ -1965,7 +2108,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE EVENT TRIGGER test_event_trigger' => {
@@ -2001,6 +2147,7 @@ my %tests = (
unlike => {
exclude_test_table => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -2019,6 +2166,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -2047,7 +2195,10 @@ my %tests = (
\n\);/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.int42' => {
@@ -2056,7 +2207,10 @@ my %tests = (
regexp => qr/^\QCREATE TYPE dump_test.int42;\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1' => {
@@ -2068,7 +2222,10 @@ my %tests = (
\s+\QPARSER = pg_catalog."default" );\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 ...' => {
@@ -2133,7 +2290,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => {
@@ -2145,7 +2305,10 @@ my %tests = (
\s+\QLEXIZE = dsimple_lexize );\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1' => {
@@ -2161,7 +2324,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => {
@@ -2174,7 +2340,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.int42_in' => {
@@ -2189,7 +2358,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.int42_out' => {
@@ -2204,7 +2376,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION ... SUPPORT' => {
@@ -2218,7 +2393,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE PROCEDURE dump_test.ptest1' => {
@@ -2232,7 +2410,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.int42 populated' => {
@@ -2256,7 +2437,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.composite' => {
@@ -2273,7 +2457,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.undefined' => {
@@ -2282,7 +2469,10 @@ my %tests = (
regexp => qr/^\QCREATE TYPE dump_test.undefined;\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FOREIGN DATA WRAPPER dummy' => {
@@ -2315,7 +2505,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE USER MAPPING FOR regress_dump_test_role SERVER s1' => {
@@ -2360,7 +2553,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_second' => {
@@ -2376,7 +2572,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_third' => {
@@ -2392,7 +2591,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_fourth' => {
@@ -2408,7 +2610,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_compression' => {
@@ -2429,8 +2634,11 @@ my %tests = (
lz4 => 1,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike =>
- { exclude_dump_test_schema => 1, no_toast_compression => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_toast_compression => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE POLICY p1 ON test_table' => {
@@ -2451,6 +2659,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2471,6 +2680,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2491,6 +2701,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2511,6 +2722,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2531,6 +2743,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2551,6 +2764,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2746,7 +2960,10 @@ my %tests = (
regexp => qr/^CREATE SCHEMA dump_test;/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE SCHEMA dump_test_second_schema' => {
@@ -2791,6 +3008,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2806,7 +3024,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_second_table' => {
@@ -2823,7 +3044,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_compression' => {
@@ -2867,11 +3091,16 @@ my %tests = (
\)\n
\QPARTITION BY RANGE (logdate);\E\n
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ exclude_measurement => 1,
},
},
@@ -2898,6 +3127,10 @@ my %tests = (
section_pre_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -2913,9 +3146,40 @@ my %tests = (
/xm,
like => {
%full_runs, %dump_test_schema_runs, section_post_data => 1,
+ only_dump_measurement => 1,
},
unlike => {
exclude_dump_test_schema => 1,
+ exclude_measurement => 1,
+ },
+ },
+
+ 'COPY measurement' => {
+ create_order => 93,
+ create_sql => 'INSERT INTO dump_test.measurement (city_id, logdate, peaktemp, unitsales) '
+ . "VALUES (1, '2006-02-12', 35, 1);",
+ regexp => qr/^
+ \QCOPY dump_test_second_schema.measurement_y2006m2 (city_id, logdate, peaktemp, unitsales) FROM stdin;\E
+ \n(?:1\t2006-02-12\t35\t1\n)\\\.\n
+ /xm,
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ data_only => 1,
+ only_dump_measurement => 1,
+ section_data => 1,
+ only_dump_test_schema => 1,
+ role_parallel => 1,
+ role => 1,
+ },
+ unlike => {
+ binary_upgrade => 1,
+ schema_only => 1,
+ exclude_measurement => 1,
+ only_dump_test_schema => 1,
+ test_schema_plus_large_objects => 1,
+ exclude_measurement => 1,
+ exclude_measurement_data => 1,
},
},
@@ -2943,6 +3207,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -2955,6 +3223,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -2967,6 +3239,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -3002,7 +3278,11 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { binary_upgrade => 1, exclude_dump_test_schema => 1, },
+ unlike => {
+ binary_upgrade => 1,
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_fourth_table_zero_col' => {
@@ -3015,7 +3295,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_fifth_table' => {
@@ -3038,7 +3321,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_sixth_table' => {
@@ -3057,7 +3343,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_seventh_table' => {
@@ -3076,7 +3365,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_table_identity' => {
@@ -3102,7 +3394,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_table_generated' => {
@@ -3119,7 +3414,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_table_generated_child1 (without local columns)' => {
@@ -3136,6 +3434,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -3165,6 +3464,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -3187,7 +3487,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_inheritance_parent' => {
@@ -3205,7 +3508,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_inheritance_child' => {
@@ -3227,6 +3533,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -3239,7 +3546,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE STATISTICS extended_stats_options' => {
@@ -3251,7 +3561,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER STATISTICS extended_stats_options' => {
@@ -3263,7 +3576,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE STATISTICS extended_stats_expression' => {
@@ -3275,7 +3591,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE SEQUENCE test_table_col1_seq' => {
@@ -3294,7 +3613,10 @@ my %tests = (
only_dump_test_table => 1,
section_pre_data => 1,
},
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE INDEX ON ONLY measurement' => {
@@ -3324,6 +3646,8 @@ my %tests = (
schema_only => 1,
section_post_data => 1,
test_schema_plus_large_objects => 1,
+ only_dump_measurement => 1,
+ exclude_measurement_data => 1,
},
unlike => {
exclude_dump_test_schema => 1,
@@ -3332,6 +3656,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
role => 1,
section_pre_data => 1,
+ exclude_measurement => 1,
},
},
@@ -3345,9 +3670,16 @@ my %tests = (
\QALTER TABLE ONLY dump_test.measurement\E \n^\s+
\QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_post_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ exclude_measurement => 1,
+ },
},
'CREATE INDEX ... ON measurement_y2006_m2' => {
@@ -3358,6 +3690,10 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -3369,6 +3705,11 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ only_dump_measurement => 1,
+ exclude_measurement_data => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -3398,6 +3739,8 @@ my %tests = (
role => 1,
schema_only => 1,
section_post_data => 1,
+ only_dump_measurement => 1,
+ exclude_measurement_data => 1,
},
unlike => {
only_dump_test_schema => 1,
@@ -3406,6 +3749,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
section_pre_data => 1,
test_schema_plus_large_objects => 1,
+ exclude_measurement => 1,
},
},
@@ -3421,7 +3765,10 @@ my %tests = (
\n\s+\QWITH LOCAL CHECK OPTION;\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER VIEW test_view SET DEFAULT' => {
@@ -3432,7 +3779,10 @@ my %tests = (
\QALTER TABLE ONLY dump_test.test_view ALTER COLUMN col1 SET DEFAULT 1;\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
# FIXME
@@ -3604,6 +3954,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3619,6 +3970,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3634,6 +3986,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3649,6 +4002,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3678,6 +4032,7 @@ my %tests = (
exclude_dump_test_schema => 1,
exclude_test_table => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3688,11 +4043,16 @@ my %tests = (
TO regress_dump_test_role;',
regexp =>
qr/^\QGRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;\E/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ exclude_measurement => 1,
},
},
@@ -3710,8 +4070,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ no_privs => 1,
+ exclude_measurement => 1,
},
- unlike => { no_privs => 1, },
},
'GRANT ALL ON LARGE OBJECT ...' => {
@@ -3755,6 +4119,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3856,6 +4221,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -3871,6 +4237,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -3958,6 +4325,7 @@ my %tests = (
only_dump_test_table => 1,
role => 1,
section_pre_data => 1,
+ only_dump_measurement => 1,
},
unlike => { no_privs => 1, },
},
@@ -3996,8 +4364,11 @@ my %tests = (
like => {
%full_runs, %dump_test_schema_runs, section_pre_data => 1,
},
- unlike =>
- { exclude_dump_test_schema => 1, no_table_access_method => 1 },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_table_access_method => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW regress_pg_dump_matview_am' => {
@@ -4017,8 +4388,11 @@ my %tests = (
like => {
%full_runs, %dump_test_schema_runs, section_pre_data => 1,
},
- unlike =>
- { exclude_dump_test_schema => 1, no_table_access_method => 1 },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_table_access_method => 1,
+ only_dump_measurement => 1,
+ },
});
#########################################
Le 11/03/2023 à 19:51, Gilles Darold a écrit :
Le 04/03/2023 à 20:18, Tom Lane a écrit :
As noted, "childs" is bad English and "partitions" is flat out wrong
(unless you change it to recurse only to partitions, which doesn't
seem like a better definition). We could go with
--[exclude-]table-and-children, or maybe
--[exclude-]table-and-child-tables, but those are getting into
carpal-tunnel-syndrome-inducing territory 🙁. I lack a better
naming suggestion offhand.In attachment is version 3 of the patch, it includes the use of
options suggested by Stephane and Tom:--table-and-children,
--exclude-table-and-children
--exclude-table-data-and-children.
Documentation have been updated too.
Thanks
New version v4 of the patch attached with a typo in documentation fixed.
--
Gilles Darold.
Attachments:
0001-dump-with-child-v4.patchtext/x-patch; charset=UTF-8; name=0001-dump-with-child-v4.patchDownload
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 334e4b7fd1..8ce4d5ff41 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -775,6 +775,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--exclude-table-and-children=<replaceable class="parameter">pattern</replaceable></option></term>
+ <listitem>
+ <para>
+ Same as <option>-T</option>/<option>--exclude-table</option> option but automatically
+ exclude partitions or child tables of the specified tables if any.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>--exclude-table-data=<replaceable class="parameter">pattern</replaceable></option></term>
<listitem>
@@ -793,6 +803,17 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--exclude-table-data-and-children=<replaceable class="parameter">pattern</replaceable></option></term>
+ <listitem>
+ <para>
+ Same as <option>--exclude-table-data</option> but automatically
+ exclude partitions or child tables of the specified tables if any.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
<varlistentry>
<term><option>--extra-float-digits=<replaceable class="parameter">ndigits</replaceable></option></term>
<listitem>
@@ -1158,6 +1179,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--table-and-children=<replaceable class="parameter">pattern</replaceable></option></term>
+ <listitem>
+ <para>
+ Same as <option>-t</option>/<option>--table</option> option but automatically
+ include partitions or child tables of the specified tables if any.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>--use-set-session-authorization</option></term>
<listitem>
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 4217908f84..09d37991d6 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -130,6 +130,10 @@ static SimpleOidList foreign_servers_include_oids = {NULL, NULL};
static SimpleStringList extension_include_patterns = {NULL, NULL};
static SimpleOidList extension_include_oids = {NULL, NULL};
+static SimpleStringList table_include_patterns_and_children = {NULL, NULL};
+static SimpleStringList table_exclude_patterns_and_children = {NULL, NULL};
+static SimpleStringList tabledata_exclude_patterns_and_children = {NULL, NULL};
+
static const CatalogId nilCatalogId = {0, 0};
/* override for standard extra_float_digits setting */
@@ -180,7 +184,8 @@ static void expand_foreign_server_name_patterns(Archive *fout,
static void expand_table_name_patterns(Archive *fout,
SimpleStringList *patterns,
SimpleOidList *oids,
- bool strict_names);
+ bool strict_names,
+ bool with_child_tables);
static void prohibit_crossdb_refs(PGconn *conn, const char *dbname,
const char *pattern);
@@ -421,6 +426,9 @@ main(int argc, char **argv)
{"on-conflict-do-nothing", no_argument, &dopt.do_nothing, 1},
{"rows-per-insert", required_argument, NULL, 10},
{"include-foreign-data", required_argument, NULL, 11},
+ {"table-and-children", required_argument, NULL, 12},
+ {"exclude-table-and-children", required_argument, NULL, 13},
+ {"exclude-table-data-and-children", required_argument, NULL, 14},
{NULL, 0, NULL, 0}
};
@@ -631,6 +639,19 @@ main(int argc, char **argv)
optarg);
break;
+ case 12: /* include table(s) with children */
+ simple_string_list_append(&table_include_patterns_and_children, optarg);
+ dopt.include_everything = false;
+ break;
+
+ case 13: /* exclude table(s) with children */
+ simple_string_list_append(&table_exclude_patterns_and_children, optarg);
+ break;
+
+ case 14: /* exclude table(s) data */
+ simple_string_list_append(&tabledata_exclude_patterns_and_children, optarg);
+ break;
+
default:
/* getopt_long already emitted a complaint */
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
@@ -814,17 +835,34 @@ main(int argc, char **argv)
{
expand_table_name_patterns(fout, &table_include_patterns,
&table_include_oids,
- strict_names);
+ strict_names, false);
if (table_include_oids.head == NULL)
pg_fatal("no matching tables were found");
}
expand_table_name_patterns(fout, &table_exclude_patterns,
&table_exclude_oids,
- false);
+ false, false);
expand_table_name_patterns(fout, &tabledata_exclude_patterns,
&tabledata_exclude_oids,
- false);
+ false, false);
+
+ /* Expand table and children selection patterns into OID lists */
+ if (table_include_patterns_and_children.head != NULL)
+ {
+ expand_table_name_patterns(fout, &table_include_patterns_and_children,
+ &table_include_oids,
+ strict_names, true);
+ if (table_include_oids.head == NULL)
+ pg_fatal("no matching tables were found");
+ }
+ expand_table_name_patterns(fout, &table_exclude_patterns_and_children,
+ &table_exclude_oids,
+ false, true);
+
+ expand_table_name_patterns(fout, &tabledata_exclude_patterns_and_children,
+ &tabledata_exclude_oids,
+ false, true);
expand_foreign_server_name_patterns(fout, &foreign_servers_include_patterns,
&foreign_servers_include_oids);
@@ -1060,7 +1098,11 @@ help(const char *progname)
printf(_(" --disable-triggers disable triggers during data-only restore\n"));
printf(_(" --enable-row-security enable row security (dump only content user has\n"
" access to)\n"));
+ printf(_(" --exclude-table-and-children=PATTERN do NOT dump the specified table(s) including\n"
+ " child and partition tables\n"));
printf(_(" --exclude-table-data=PATTERN do NOT dump data for the specified table(s)\n"));
+ printf(_(" --exclude-table-data-and-children=PATTERN do NOT dump data for the specified\n"
+ " table(s) including child and partition tables\n"));
printf(_(" --extra-float-digits=NUM override default setting for extra_float_digits\n"));
printf(_(" --if-exists use IF EXISTS when dropping objects\n"));
printf(_(" --include-foreign-data=PATTERN\n"
@@ -1084,6 +1126,8 @@ help(const char *progname)
printf(_(" --snapshot=SNAPSHOT use given snapshot for the dump\n"));
printf(_(" --strict-names require table and/or schema include patterns to\n"
" match at least one entity each\n"));
+ printf(_(" --table-and-children=PATTERN dump the specified table(s) only including child\n"
+ " and partition tables\n"));
printf(_(" --use-set-session-authorization\n"
" use SET SESSION AUTHORIZATION commands instead of\n"
" ALTER OWNER commands to set ownership\n"));
@@ -1497,7 +1541,7 @@ expand_foreign_server_name_patterns(Archive *fout,
static void
expand_table_name_patterns(Archive *fout,
SimpleStringList *patterns, SimpleOidList *oids,
- bool strict_names)
+ bool strict_names, bool with_child_tables)
{
PQExpBuffer query;
PGresult *res;
@@ -1519,6 +1563,15 @@ expand_table_name_patterns(Archive *fout,
PQExpBufferData dbbuf;
int dotcnt;
+ /*
+ * With --include_child we look recursively to the inheritance
+ * tree to find the partitions tables of the matching include filter
+ */
+ if (with_child_tables)
+ {
+ appendPQExpBuffer(query, "WITH RECURSIVE partition_tree (relid) AS (\n");
+ }
+
/*
* Query must remain ABSOLUTELY devoid of unqualified names. This
* would be unnecessary given a pg_table_is_visible() variant taking a
@@ -1546,6 +1599,20 @@ expand_table_name_patterns(Archive *fout,
prohibit_crossdb_refs(GetConnection(fout), dbbuf.data, cell->val);
termPQExpBuffer(&dbbuf);
+ if (with_child_tables)
+ {
+ appendPQExpBuffer(query, "\n UNION ALL"
+ "\n SELECT c.oid AS relid"
+ "\n FROM partition_tree AS p"
+ "\n JOIN pg_catalog.pg_inherits AS i"
+ "\n ON (p.relid OPERATOR(pg_catalog.=) i.inhparent)"
+ "\n JOIN pg_catalog.pg_class AS c"
+ "\n ON (c.oid OPERATOR(pg_catalog.=) i.inhrelid)"
+ "\n)"
+ "\nSELECT relid FROM partition_tree");
+
+ }
+
ExecuteSqlStatement(fout, "RESET search_path");
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
PQclear(ExecuteSqlQueryForSingleRow(fout,
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 9c354213ce..c9fc015928 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -393,6 +393,24 @@ my %pgdump_runs = (
'--exclude-table=dump_test.test_table', 'postgres',
],
},
+ exclude_measurement => {
+ dump_cmd => [
+ 'pg_dump', '--no-sync',
+ "--file=$tempdir/exclude_measurement.sql",
+ '--exclude-table-and-children=dump_test.measurement',
+ 'postgres',
+ ],
+ },
+ exclude_measurement_data => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ "--file=$tempdir/exclude_measurement_data.sql",
+ '--exclude-table-data-and-children=dump_test.measurement',
+ '--no-unlogged-table-data',
+ 'postgres',
+ ],
+ },
exclude_test_table_data => {
dump_cmd => [
'pg_dump',
@@ -487,6 +505,17 @@ my %pgdump_runs = (
'postgres',
],
},
+ only_dump_measurement => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ "--file=$tempdir/only_dump_measurement.sql",
+ '--table-and-children=dump_test.measurement',
+ '--lock-wait-timeout='
+ . (1000 * $PostgreSQL::Test::Utils::timeout_default),
+ 'postgres',
+ ],
+ },
role => {
dump_cmd => [
'pg_dump',
@@ -604,6 +633,7 @@ my %pgdump_runs = (
# Tests which target the 'dump_test' schema, specifically.
my %dump_test_schema_runs = (
only_dump_test_schema => 1,
+ only_dump_measurement => 1,
test_schema_plus_large_objects => 1,);
# Tests which are considered 'full' dumps by pg_dump, but there
@@ -618,6 +648,8 @@ my %full_runs = (
exclude_dump_test_schema => 1,
exclude_test_table => 1,
exclude_test_table_data => 1,
+ exclude_measurement => 1,
+ exclude_measurement_data => 1,
no_toast_compression => 1,
no_large_objects => 1,
no_owner => 1,
@@ -644,6 +676,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -663,6 +696,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -741,6 +775,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -754,6 +789,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -786,7 +822,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER OPERATOR CLASS dump_test.op_class OWNER TO' => {
@@ -799,6 +838,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -838,6 +878,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -884,6 +925,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -901,6 +943,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -920,6 +963,7 @@ my %tests = (
},
unlike => {
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -939,6 +983,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -958,6 +1003,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -977,6 +1023,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -996,6 +1043,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1010,6 +1058,10 @@ my %tests = (
role => 1,
section_pre_data => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -1029,6 +1081,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1050,7 +1103,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER TABLE test_table OWNER TO' => {
@@ -1064,6 +1120,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
no_owner => 1,
},
},
@@ -1083,6 +1140,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1094,16 +1152,22 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
'ALTER TABLE measurement OWNER TO' => {
regexp => qr/^\QALTER TABLE dump_test.measurement OWNER TO \E.+;/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ exclude_measurement => 1,
},
},
@@ -1114,8 +1178,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ no_owner => 1,
+ exclude_measurement => 1,
},
- unlike => { no_owner => 1, },
},
'ALTER FOREIGN TABLE foreign_table OWNER TO' => {
@@ -1126,6 +1194,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -1137,6 +1206,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -1150,6 +1220,7 @@ my %tests = (
only_dump_test_table => 1,
no_owner => 1,
role => 1,
+ only_dump_measurement => 1,
},
},
@@ -1240,6 +1311,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1259,6 +1331,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1271,7 +1344,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON COLUMN dump_test.test_second_table.col1' => {
@@ -1283,7 +1359,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON COLUMN dump_test.test_second_table.col2' => {
@@ -1295,7 +1374,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON CONVERSION dump_test.test_conversion' => {
@@ -1306,7 +1388,10 @@ my %tests = (
qr/^\QCOMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversion';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON COLLATION test0' => {
@@ -1372,7 +1457,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 IS 'comment on text search configuration';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => {
@@ -1384,7 +1472,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 IS 'comment on text search dictionary';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1' => {
@@ -1395,7 +1486,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 IS 'comment on text search parser';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => {
@@ -1406,7 +1500,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text search template';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.planets - ENUM' => {
@@ -1417,7 +1514,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.planets IS 'comment on enum type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.textrange - RANGE' => {
@@ -1428,7 +1528,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.textrange IS 'comment on range type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.int42 - Regular' => {
@@ -1439,7 +1542,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.int42 IS 'comment on regular type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.undefined - Undefined' => {
@@ -1450,7 +1556,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COPY test_table' => {
@@ -1474,6 +1583,7 @@ my %tests = (
exclude_test_table => 1,
exclude_test_table_data => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1497,6 +1607,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1532,6 +1643,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1553,6 +1665,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1575,6 +1688,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1596,6 +1710,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1617,6 +1732,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1796,7 +1912,10 @@ my %tests = (
exclude_test_table => 1,
section_pre_data => 1,
},
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE CONVERSION dump_test.test_conversion' => {
@@ -1807,7 +1926,10 @@ my %tests = (
qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE DOMAIN dump_test.us_postal_code' => {
@@ -1829,7 +1951,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.pltestlang_call_handler' => {
@@ -1846,7 +1971,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.trigger_func' => {
@@ -1862,7 +1990,10 @@ my %tests = (
\$\$;/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.event_trigger_func' => {
@@ -1878,7 +2009,10 @@ my %tests = (
\$\$;/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE OPERATOR FAMILY dump_test.op_family' => {
@@ -1890,7 +2024,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE OPERATOR CLASS dump_test.op_class' => {
@@ -1920,7 +2057,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
# verify that a custom operator/opclass/range type is dumped in right order
@@ -1950,7 +2090,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE OPERATOR CLASS dump_test.op_class_empty' => {
@@ -1965,7 +2108,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE EVENT TRIGGER test_event_trigger' => {
@@ -2001,6 +2147,7 @@ my %tests = (
unlike => {
exclude_test_table => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -2019,6 +2166,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -2047,7 +2195,10 @@ my %tests = (
\n\);/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.int42' => {
@@ -2056,7 +2207,10 @@ my %tests = (
regexp => qr/^\QCREATE TYPE dump_test.int42;\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1' => {
@@ -2068,7 +2222,10 @@ my %tests = (
\s+\QPARSER = pg_catalog."default" );\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 ...' => {
@@ -2133,7 +2290,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => {
@@ -2145,7 +2305,10 @@ my %tests = (
\s+\QLEXIZE = dsimple_lexize );\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1' => {
@@ -2161,7 +2324,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => {
@@ -2174,7 +2340,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.int42_in' => {
@@ -2189,7 +2358,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.int42_out' => {
@@ -2204,7 +2376,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION ... SUPPORT' => {
@@ -2218,7 +2393,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE PROCEDURE dump_test.ptest1' => {
@@ -2232,7 +2410,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.int42 populated' => {
@@ -2256,7 +2437,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.composite' => {
@@ -2273,7 +2457,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.undefined' => {
@@ -2282,7 +2469,10 @@ my %tests = (
regexp => qr/^\QCREATE TYPE dump_test.undefined;\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FOREIGN DATA WRAPPER dummy' => {
@@ -2315,7 +2505,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE USER MAPPING FOR regress_dump_test_role SERVER s1' => {
@@ -2360,7 +2553,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_second' => {
@@ -2376,7 +2572,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_third' => {
@@ -2392,7 +2591,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_fourth' => {
@@ -2408,7 +2610,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_compression' => {
@@ -2429,8 +2634,11 @@ my %tests = (
lz4 => 1,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike =>
- { exclude_dump_test_schema => 1, no_toast_compression => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_toast_compression => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE POLICY p1 ON test_table' => {
@@ -2451,6 +2659,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2471,6 +2680,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2491,6 +2701,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2511,6 +2722,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2531,6 +2743,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2551,6 +2764,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2746,7 +2960,10 @@ my %tests = (
regexp => qr/^CREATE SCHEMA dump_test;/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE SCHEMA dump_test_second_schema' => {
@@ -2791,6 +3008,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2806,7 +3024,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_second_table' => {
@@ -2823,7 +3044,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_compression' => {
@@ -2867,11 +3091,16 @@ my %tests = (
\)\n
\QPARTITION BY RANGE (logdate);\E\n
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ exclude_measurement => 1,
},
},
@@ -2898,6 +3127,10 @@ my %tests = (
section_pre_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -2913,9 +3146,40 @@ my %tests = (
/xm,
like => {
%full_runs, %dump_test_schema_runs, section_post_data => 1,
+ only_dump_measurement => 1,
},
unlike => {
exclude_dump_test_schema => 1,
+ exclude_measurement => 1,
+ },
+ },
+
+ 'COPY measurement' => {
+ create_order => 93,
+ create_sql => 'INSERT INTO dump_test.measurement (city_id, logdate, peaktemp, unitsales) '
+ . "VALUES (1, '2006-02-12', 35, 1);",
+ regexp => qr/^
+ \QCOPY dump_test_second_schema.measurement_y2006m2 (city_id, logdate, peaktemp, unitsales) FROM stdin;\E
+ \n(?:1\t2006-02-12\t35\t1\n)\\\.\n
+ /xm,
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ data_only => 1,
+ only_dump_measurement => 1,
+ section_data => 1,
+ only_dump_test_schema => 1,
+ role_parallel => 1,
+ role => 1,
+ },
+ unlike => {
+ binary_upgrade => 1,
+ schema_only => 1,
+ exclude_measurement => 1,
+ only_dump_test_schema => 1,
+ test_schema_plus_large_objects => 1,
+ exclude_measurement => 1,
+ exclude_measurement_data => 1,
},
},
@@ -2943,6 +3207,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -2955,6 +3223,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -2967,6 +3239,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -3002,7 +3278,11 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { binary_upgrade => 1, exclude_dump_test_schema => 1, },
+ unlike => {
+ binary_upgrade => 1,
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_fourth_table_zero_col' => {
@@ -3015,7 +3295,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_fifth_table' => {
@@ -3038,7 +3321,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_sixth_table' => {
@@ -3057,7 +3343,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_seventh_table' => {
@@ -3076,7 +3365,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_table_identity' => {
@@ -3102,7 +3394,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_table_generated' => {
@@ -3119,7 +3414,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_table_generated_child1 (without local columns)' => {
@@ -3136,6 +3434,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -3165,6 +3464,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -3187,7 +3487,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_inheritance_parent' => {
@@ -3205,7 +3508,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_inheritance_child' => {
@@ -3227,6 +3533,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -3239,7 +3546,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE STATISTICS extended_stats_options' => {
@@ -3251,7 +3561,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER STATISTICS extended_stats_options' => {
@@ -3263,7 +3576,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE STATISTICS extended_stats_expression' => {
@@ -3275,7 +3591,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE SEQUENCE test_table_col1_seq' => {
@@ -3294,7 +3613,10 @@ my %tests = (
only_dump_test_table => 1,
section_pre_data => 1,
},
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE INDEX ON ONLY measurement' => {
@@ -3324,6 +3646,8 @@ my %tests = (
schema_only => 1,
section_post_data => 1,
test_schema_plus_large_objects => 1,
+ only_dump_measurement => 1,
+ exclude_measurement_data => 1,
},
unlike => {
exclude_dump_test_schema => 1,
@@ -3332,6 +3656,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
role => 1,
section_pre_data => 1,
+ exclude_measurement => 1,
},
},
@@ -3345,9 +3670,16 @@ my %tests = (
\QALTER TABLE ONLY dump_test.measurement\E \n^\s+
\QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_post_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ exclude_measurement => 1,
+ },
},
'CREATE INDEX ... ON measurement_y2006_m2' => {
@@ -3358,6 +3690,10 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -3369,6 +3705,11 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ only_dump_measurement => 1,
+ exclude_measurement_data => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -3398,6 +3739,8 @@ my %tests = (
role => 1,
schema_only => 1,
section_post_data => 1,
+ only_dump_measurement => 1,
+ exclude_measurement_data => 1,
},
unlike => {
only_dump_test_schema => 1,
@@ -3406,6 +3749,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
section_pre_data => 1,
test_schema_plus_large_objects => 1,
+ exclude_measurement => 1,
},
},
@@ -3421,7 +3765,10 @@ my %tests = (
\n\s+\QWITH LOCAL CHECK OPTION;\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER VIEW test_view SET DEFAULT' => {
@@ -3432,7 +3779,10 @@ my %tests = (
\QALTER TABLE ONLY dump_test.test_view ALTER COLUMN col1 SET DEFAULT 1;\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
# FIXME
@@ -3604,6 +3954,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3619,6 +3970,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3634,6 +3986,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3649,6 +4002,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3678,6 +4032,7 @@ my %tests = (
exclude_dump_test_schema => 1,
exclude_test_table => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3688,11 +4043,16 @@ my %tests = (
TO regress_dump_test_role;',
regexp =>
qr/^\QGRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;\E/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ exclude_measurement => 1,
},
},
@@ -3710,8 +4070,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ no_privs => 1,
+ exclude_measurement => 1,
},
- unlike => { no_privs => 1, },
},
'GRANT ALL ON LARGE OBJECT ...' => {
@@ -3755,6 +4119,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3856,6 +4221,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -3871,6 +4237,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -3958,6 +4325,7 @@ my %tests = (
only_dump_test_table => 1,
role => 1,
section_pre_data => 1,
+ only_dump_measurement => 1,
},
unlike => { no_privs => 1, },
},
@@ -3996,8 +4364,11 @@ my %tests = (
like => {
%full_runs, %dump_test_schema_runs, section_pre_data => 1,
},
- unlike =>
- { exclude_dump_test_schema => 1, no_table_access_method => 1 },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_table_access_method => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW regress_pg_dump_matview_am' => {
@@ -4017,8 +4388,11 @@ my %tests = (
like => {
%full_runs, %dump_test_schema_runs, section_pre_data => 1,
},
- unlike =>
- { exclude_dump_test_schema => 1, no_table_access_method => 1 },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_table_access_method => 1,
+ only_dump_measurement => 1,
+ },
});
#########################################
Hi Gilles,
On Ubuntu 22.04.2 all deb's updated, I have an error on a test
I'll try to find where and why, but I think you should know first.
1/1 postgresql:pg_dump / pg_dump/002_pg_dump ERROR 24.40s
exit status 1
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
✀
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
stderr:
# Failed test 'only_dump_measurement: should dump CREATE TABLE
test_compression'
# at /media/hddisk/stephane/postgresql/src/postgresql/src/bin/pg_dump/t/
002_pg_dump.pl line 4729.
# Review only_dump_measurement results in
/media/hddisk/stephane/postgresql/build/testrun/pg_dump/002_pg_dump/data/tmp_test_iJxJ
# Looks like you failed 1 test of 10264.
(test program exited with status code 1)
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Summary of Failures:
1/1 postgresql:pg_dump / pg_dump/002_pg_dump ERROR 24.40s exit
status 1
Ok: 0
Expected Fail: 0
Fail: 1
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Join, only_dump_measurement.sql from
/media/hddisk/stephane/postgresql/build/testrun/pg_dump/002_pg_dump/data/tmp_test_iJxJ
If you need more information, please ask...
Stéphane.
Le dim. 12 mars 2023 à 10:04, Gilles Darold <gilles@migops.com> a écrit :
Le 11/03/2023 à 19:51, Gilles Darold a écrit :
Le 04/03/2023 à 20:18, Tom Lane a écrit :
As noted, "childs" is bad English and "partitions" is flat out wrong
(unless you change it to recurse only to partitions, which doesn't
seem like a better definition). We could go with
--[exclude-]table-and-children, or maybe
--[exclude-]table-and-child-tables, but those are getting into
carpal-tunnel-syndrome-inducing territory 🙁. I lack a better
naming suggestion offhand.In attachment is version 3 of the patch, it includes the use of
options suggested by Stephane and Tom:--table-and-children,
--exclude-table-and-children
--exclude-table-data-and-children.
Documentation have been updated too.
Thanks
New version v4 of the patch attached with a typo in documentation fixed.
--
Gilles Darold.
--
"Où se posaient les hirondelles avant l'invention du téléphone ?"
-- Grégoire Lacroix
Attachments:
Le 12/03/2023 à 19:05, Stéphane Tachoires a écrit :
Hi Gilles,
On Ubuntu 22.04.2 all deb's updated, I have an error on a test
I'll try to find where and why, but I think you should know first.1/1 postgresql:pg_dump / pg_dump/002_pg_dump ERROR
24.40s exit status 1
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
✀
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
stderr:
# Failed test 'only_dump_measurement: should dump CREATE TABLE
test_compression'
# at
/media/hddisk/stephane/postgresql/src/postgresql/src/bin/pg_dump/t/002_pg_dump.pl
<http://002_pg_dump.pl> line 4729.
# Review only_dump_measurement results in
/media/hddisk/stephane/postgresql/build/testrun/pg_dump/002_pg_dump/data/tmp_test_iJxJ
# Looks like you failed 1 test of 10264.
Hi Stephane,
Odd, I do not have this error when running make installcheck, I have the
same OS version as you.
+++ tap check in src/bin/pg_dump +++
t/001_basic.pl ................ ok
t/002_pg_dump.pl .............. ok
t/003_pg_dump_with_server.pl .. ok
t/010_dump_connstr.pl ......... ok
All tests successful.
Files=4, Tests=9531, 11 wallclock secs ( 0.33 usr 0.04 sys + 3.05
cusr 1.22 csys = 4.64 CPU)
Result: PASS
Anyway this test must be fixed and this is done in version v5 of the
patch attached here.
Thanks for the review.
--
Gilles Darold
Attachments:
0001-dump-with-child-v5.patchtext/x-patch; charset=UTF-8; name=0001-dump-with-child-v5.patchDownload
diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 334e4b7fd1..8ce4d5ff41 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -775,6 +775,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--exclude-table-and-children=<replaceable class="parameter">pattern</replaceable></option></term>
+ <listitem>
+ <para>
+ Same as <option>-T</option>/<option>--exclude-table</option> option but automatically
+ exclude partitions or child tables of the specified tables if any.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>--exclude-table-data=<replaceable class="parameter">pattern</replaceable></option></term>
<listitem>
@@ -793,6 +803,17 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--exclude-table-data-and-children=<replaceable class="parameter">pattern</replaceable></option></term>
+ <listitem>
+ <para>
+ Same as <option>--exclude-table-data</option> but automatically
+ exclude partitions or child tables of the specified tables if any.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
<varlistentry>
<term><option>--extra-float-digits=<replaceable class="parameter">ndigits</replaceable></option></term>
<listitem>
@@ -1158,6 +1179,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--table-and-children=<replaceable class="parameter">pattern</replaceable></option></term>
+ <listitem>
+ <para>
+ Same as <option>-t</option>/<option>--table</option> option but automatically
+ include partitions or child tables of the specified tables if any.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>--use-set-session-authorization</option></term>
<listitem>
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 4217908f84..09d37991d6 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -130,6 +130,10 @@ static SimpleOidList foreign_servers_include_oids = {NULL, NULL};
static SimpleStringList extension_include_patterns = {NULL, NULL};
static SimpleOidList extension_include_oids = {NULL, NULL};
+static SimpleStringList table_include_patterns_and_children = {NULL, NULL};
+static SimpleStringList table_exclude_patterns_and_children = {NULL, NULL};
+static SimpleStringList tabledata_exclude_patterns_and_children = {NULL, NULL};
+
static const CatalogId nilCatalogId = {0, 0};
/* override for standard extra_float_digits setting */
@@ -180,7 +184,8 @@ static void expand_foreign_server_name_patterns(Archive *fout,
static void expand_table_name_patterns(Archive *fout,
SimpleStringList *patterns,
SimpleOidList *oids,
- bool strict_names);
+ bool strict_names,
+ bool with_child_tables);
static void prohibit_crossdb_refs(PGconn *conn, const char *dbname,
const char *pattern);
@@ -421,6 +426,9 @@ main(int argc, char **argv)
{"on-conflict-do-nothing", no_argument, &dopt.do_nothing, 1},
{"rows-per-insert", required_argument, NULL, 10},
{"include-foreign-data", required_argument, NULL, 11},
+ {"table-and-children", required_argument, NULL, 12},
+ {"exclude-table-and-children", required_argument, NULL, 13},
+ {"exclude-table-data-and-children", required_argument, NULL, 14},
{NULL, 0, NULL, 0}
};
@@ -631,6 +639,19 @@ main(int argc, char **argv)
optarg);
break;
+ case 12: /* include table(s) with children */
+ simple_string_list_append(&table_include_patterns_and_children, optarg);
+ dopt.include_everything = false;
+ break;
+
+ case 13: /* exclude table(s) with children */
+ simple_string_list_append(&table_exclude_patterns_and_children, optarg);
+ break;
+
+ case 14: /* exclude table(s) data */
+ simple_string_list_append(&tabledata_exclude_patterns_and_children, optarg);
+ break;
+
default:
/* getopt_long already emitted a complaint */
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
@@ -814,17 +835,34 @@ main(int argc, char **argv)
{
expand_table_name_patterns(fout, &table_include_patterns,
&table_include_oids,
- strict_names);
+ strict_names, false);
if (table_include_oids.head == NULL)
pg_fatal("no matching tables were found");
}
expand_table_name_patterns(fout, &table_exclude_patterns,
&table_exclude_oids,
- false);
+ false, false);
expand_table_name_patterns(fout, &tabledata_exclude_patterns,
&tabledata_exclude_oids,
- false);
+ false, false);
+
+ /* Expand table and children selection patterns into OID lists */
+ if (table_include_patterns_and_children.head != NULL)
+ {
+ expand_table_name_patterns(fout, &table_include_patterns_and_children,
+ &table_include_oids,
+ strict_names, true);
+ if (table_include_oids.head == NULL)
+ pg_fatal("no matching tables were found");
+ }
+ expand_table_name_patterns(fout, &table_exclude_patterns_and_children,
+ &table_exclude_oids,
+ false, true);
+
+ expand_table_name_patterns(fout, &tabledata_exclude_patterns_and_children,
+ &tabledata_exclude_oids,
+ false, true);
expand_foreign_server_name_patterns(fout, &foreign_servers_include_patterns,
&foreign_servers_include_oids);
@@ -1060,7 +1098,11 @@ help(const char *progname)
printf(_(" --disable-triggers disable triggers during data-only restore\n"));
printf(_(" --enable-row-security enable row security (dump only content user has\n"
" access to)\n"));
+ printf(_(" --exclude-table-and-children=PATTERN do NOT dump the specified table(s) including\n"
+ " child and partition tables\n"));
printf(_(" --exclude-table-data=PATTERN do NOT dump data for the specified table(s)\n"));
+ printf(_(" --exclude-table-data-and-children=PATTERN do NOT dump data for the specified\n"
+ " table(s) including child and partition tables\n"));
printf(_(" --extra-float-digits=NUM override default setting for extra_float_digits\n"));
printf(_(" --if-exists use IF EXISTS when dropping objects\n"));
printf(_(" --include-foreign-data=PATTERN\n"
@@ -1084,6 +1126,8 @@ help(const char *progname)
printf(_(" --snapshot=SNAPSHOT use given snapshot for the dump\n"));
printf(_(" --strict-names require table and/or schema include patterns to\n"
" match at least one entity each\n"));
+ printf(_(" --table-and-children=PATTERN dump the specified table(s) only including child\n"
+ " and partition tables\n"));
printf(_(" --use-set-session-authorization\n"
" use SET SESSION AUTHORIZATION commands instead of\n"
" ALTER OWNER commands to set ownership\n"));
@@ -1497,7 +1541,7 @@ expand_foreign_server_name_patterns(Archive *fout,
static void
expand_table_name_patterns(Archive *fout,
SimpleStringList *patterns, SimpleOidList *oids,
- bool strict_names)
+ bool strict_names, bool with_child_tables)
{
PQExpBuffer query;
PGresult *res;
@@ -1519,6 +1563,15 @@ expand_table_name_patterns(Archive *fout,
PQExpBufferData dbbuf;
int dotcnt;
+ /*
+ * With --include_child we look recursively to the inheritance
+ * tree to find the partitions tables of the matching include filter
+ */
+ if (with_child_tables)
+ {
+ appendPQExpBuffer(query, "WITH RECURSIVE partition_tree (relid) AS (\n");
+ }
+
/*
* Query must remain ABSOLUTELY devoid of unqualified names. This
* would be unnecessary given a pg_table_is_visible() variant taking a
@@ -1546,6 +1599,20 @@ expand_table_name_patterns(Archive *fout,
prohibit_crossdb_refs(GetConnection(fout), dbbuf.data, cell->val);
termPQExpBuffer(&dbbuf);
+ if (with_child_tables)
+ {
+ appendPQExpBuffer(query, "\n UNION ALL"
+ "\n SELECT c.oid AS relid"
+ "\n FROM partition_tree AS p"
+ "\n JOIN pg_catalog.pg_inherits AS i"
+ "\n ON (p.relid OPERATOR(pg_catalog.=) i.inhparent)"
+ "\n JOIN pg_catalog.pg_class AS c"
+ "\n ON (c.oid OPERATOR(pg_catalog.=) i.inhrelid)"
+ "\n)"
+ "\nSELECT relid FROM partition_tree");
+
+ }
+
ExecuteSqlStatement(fout, "RESET search_path");
res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK);
PQclear(ExecuteSqlQueryForSingleRow(fout,
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 9c354213ce..a22f27f300 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -393,6 +393,24 @@ my %pgdump_runs = (
'--exclude-table=dump_test.test_table', 'postgres',
],
},
+ exclude_measurement => {
+ dump_cmd => [
+ 'pg_dump', '--no-sync',
+ "--file=$tempdir/exclude_measurement.sql",
+ '--exclude-table-and-children=dump_test.measurement',
+ 'postgres',
+ ],
+ },
+ exclude_measurement_data => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ "--file=$tempdir/exclude_measurement_data.sql",
+ '--exclude-table-data-and-children=dump_test.measurement',
+ '--no-unlogged-table-data',
+ 'postgres',
+ ],
+ },
exclude_test_table_data => {
dump_cmd => [
'pg_dump',
@@ -487,6 +505,17 @@ my %pgdump_runs = (
'postgres',
],
},
+ only_dump_measurement => {
+ dump_cmd => [
+ 'pg_dump',
+ '--no-sync',
+ "--file=$tempdir/only_dump_measurement.sql",
+ '--table-and-children=dump_test.measurement',
+ '--lock-wait-timeout='
+ . (1000 * $PostgreSQL::Test::Utils::timeout_default),
+ 'postgres',
+ ],
+ },
role => {
dump_cmd => [
'pg_dump',
@@ -604,6 +633,7 @@ my %pgdump_runs = (
# Tests which target the 'dump_test' schema, specifically.
my %dump_test_schema_runs = (
only_dump_test_schema => 1,
+ only_dump_measurement => 1,
test_schema_plus_large_objects => 1,);
# Tests which are considered 'full' dumps by pg_dump, but there
@@ -618,6 +648,8 @@ my %full_runs = (
exclude_dump_test_schema => 1,
exclude_test_table => 1,
exclude_test_table_data => 1,
+ exclude_measurement => 1,
+ exclude_measurement_data => 1,
no_toast_compression => 1,
no_large_objects => 1,
no_owner => 1,
@@ -644,6 +676,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -663,6 +696,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -741,6 +775,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -754,6 +789,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -786,7 +822,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER OPERATOR CLASS dump_test.op_class OWNER TO' => {
@@ -799,6 +838,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -838,6 +878,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -884,6 +925,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -901,6 +943,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -920,6 +963,7 @@ my %tests = (
},
unlike => {
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -939,6 +983,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -958,6 +1003,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -977,6 +1023,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -996,6 +1043,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1010,6 +1058,10 @@ my %tests = (
role => 1,
section_pre_data => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -1029,6 +1081,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1050,7 +1103,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER TABLE test_table OWNER TO' => {
@@ -1064,6 +1120,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
no_owner => 1,
},
},
@@ -1083,6 +1140,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1094,16 +1152,22 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
'ALTER TABLE measurement OWNER TO' => {
regexp => qr/^\QALTER TABLE dump_test.measurement OWNER TO \E.+;/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ exclude_measurement => 1,
},
},
@@ -1114,8 +1178,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ no_owner => 1,
+ exclude_measurement => 1,
},
- unlike => { no_owner => 1, },
},
'ALTER FOREIGN TABLE foreign_table OWNER TO' => {
@@ -1126,6 +1194,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -1137,6 +1206,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_owner => 1,
+ only_dump_measurement => 1,
},
},
@@ -1150,6 +1220,7 @@ my %tests = (
only_dump_test_table => 1,
no_owner => 1,
role => 1,
+ only_dump_measurement => 1,
},
},
@@ -1240,6 +1311,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1259,6 +1331,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -1271,7 +1344,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON COLUMN dump_test.test_second_table.col1' => {
@@ -1283,7 +1359,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON COLUMN dump_test.test_second_table.col2' => {
@@ -1295,7 +1374,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON CONVERSION dump_test.test_conversion' => {
@@ -1306,7 +1388,10 @@ my %tests = (
qr/^\QCOMMENT ON CONVERSION dump_test.test_conversion IS 'comment on test conversion';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON COLLATION test0' => {
@@ -1372,7 +1457,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 IS 'comment on text search configuration';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => {
@@ -1384,7 +1472,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1 IS 'comment on text search dictionary';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1' => {
@@ -1395,7 +1486,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH PARSER dump_test.alt_ts_prs1 IS 'comment on text search parser';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => {
@@ -1406,7 +1500,10 @@ my %tests = (
qr/^\QCOMMENT ON TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1 IS 'comment on text search template';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.planets - ENUM' => {
@@ -1417,7 +1514,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.planets IS 'comment on enum type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.textrange - RANGE' => {
@@ -1428,7 +1528,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.textrange IS 'comment on range type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.int42 - Regular' => {
@@ -1439,7 +1542,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.int42 IS 'comment on regular type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COMMENT ON TYPE dump_test.undefined - Undefined' => {
@@ -1450,7 +1556,10 @@ my %tests = (
qr/^\QCOMMENT ON TYPE dump_test.undefined IS 'comment on undefined type';\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'COPY test_table' => {
@@ -1474,6 +1583,7 @@ my %tests = (
exclude_test_table => 1,
exclude_test_table_data => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1497,6 +1607,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1532,6 +1643,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1553,6 +1665,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1575,6 +1688,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1596,6 +1710,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1617,6 +1732,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -1796,7 +1912,10 @@ my %tests = (
exclude_test_table => 1,
section_pre_data => 1,
},
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE CONVERSION dump_test.test_conversion' => {
@@ -1807,7 +1926,10 @@ my %tests = (
qr/^\QCREATE DEFAULT CONVERSION dump_test.test_conversion FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE DOMAIN dump_test.us_postal_code' => {
@@ -1829,7 +1951,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.pltestlang_call_handler' => {
@@ -1846,7 +1971,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.trigger_func' => {
@@ -1862,7 +1990,10 @@ my %tests = (
\$\$;/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.event_trigger_func' => {
@@ -1878,7 +2009,10 @@ my %tests = (
\$\$;/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE OPERATOR FAMILY dump_test.op_family' => {
@@ -1890,7 +2024,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE OPERATOR CLASS dump_test.op_class' => {
@@ -1920,7 +2057,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
# verify that a custom operator/opclass/range type is dumped in right order
@@ -1950,7 +2090,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE OPERATOR CLASS dump_test.op_class_empty' => {
@@ -1965,7 +2108,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE EVENT TRIGGER test_event_trigger' => {
@@ -2001,6 +2147,7 @@ my %tests = (
unlike => {
exclude_test_table => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -2019,6 +2166,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -2047,7 +2195,10 @@ my %tests = (
\n\);/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.int42' => {
@@ -2056,7 +2207,10 @@ my %tests = (
regexp => qr/^\QCREATE TYPE dump_test.int42;\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1' => {
@@ -2068,7 +2222,10 @@ my %tests = (
\s+\QPARSER = pg_catalog."default" );\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER TEXT SEARCH CONFIGURATION dump_test.alt_ts_conf1 ...' => {
@@ -2133,7 +2290,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH TEMPLATE dump_test.alt_ts_temp1' => {
@@ -2145,7 +2305,10 @@ my %tests = (
\s+\QLEXIZE = dsimple_lexize );\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH PARSER dump_test.alt_ts_prs1' => {
@@ -2161,7 +2324,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TEXT SEARCH DICTIONARY dump_test.alt_ts_dict1' => {
@@ -2174,7 +2340,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.int42_in' => {
@@ -2189,7 +2358,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION dump_test.int42_out' => {
@@ -2204,7 +2376,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FUNCTION ... SUPPORT' => {
@@ -2218,7 +2393,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE PROCEDURE dump_test.ptest1' => {
@@ -2232,7 +2410,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.int42 populated' => {
@@ -2256,7 +2437,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.composite' => {
@@ -2273,7 +2457,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TYPE dump_test.undefined' => {
@@ -2282,7 +2469,10 @@ my %tests = (
regexp => qr/^\QCREATE TYPE dump_test.undefined;\E/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE FOREIGN DATA WRAPPER dummy' => {
@@ -2315,7 +2505,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE USER MAPPING FOR regress_dump_test_role SERVER s1' => {
@@ -2360,7 +2553,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_second' => {
@@ -2376,7 +2572,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_third' => {
@@ -2392,7 +2591,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_fourth' => {
@@ -2408,7 +2610,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW matview_compression' => {
@@ -2429,8 +2634,11 @@ my %tests = (
lz4 => 1,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike =>
- { exclude_dump_test_schema => 1, no_toast_compression => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_toast_compression => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE POLICY p1 ON test_table' => {
@@ -2451,6 +2659,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2471,6 +2680,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2491,6 +2701,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2511,6 +2722,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2531,6 +2743,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2551,6 +2764,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2746,7 +2960,10 @@ my %tests = (
regexp => qr/^CREATE SCHEMA dump_test;/m,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE SCHEMA dump_test_second_schema' => {
@@ -2791,6 +3008,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
exclude_test_table => 1,
+ only_dump_measurement => 1,
},
},
@@ -2806,7 +3024,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_second_table' => {
@@ -2823,7 +3044,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_compression' => {
@@ -2843,8 +3067,11 @@ my %tests = (
lz4 => 1,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike =>
- { exclude_dump_test_schema => 1, no_toast_compression => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_toast_compression => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE measurement PARTITIONED BY' => {
@@ -2867,11 +3094,16 @@ my %tests = (
\)\n
\QPARTITION BY RANGE (logdate);\E\n
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ exclude_measurement => 1,
},
},
@@ -2898,6 +3130,10 @@ my %tests = (
section_pre_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -2913,9 +3149,40 @@ my %tests = (
/xm,
like => {
%full_runs, %dump_test_schema_runs, section_post_data => 1,
+ only_dump_measurement => 1,
},
unlike => {
exclude_dump_test_schema => 1,
+ exclude_measurement => 1,
+ },
+ },
+
+ 'COPY measurement' => {
+ create_order => 93,
+ create_sql => 'INSERT INTO dump_test.measurement (city_id, logdate, peaktemp, unitsales) '
+ . "VALUES (1, '2006-02-12', 35, 1);",
+ regexp => qr/^
+ \QCOPY dump_test_second_schema.measurement_y2006m2 (city_id, logdate, peaktemp, unitsales) FROM stdin;\E
+ \n(?:1\t2006-02-12\t35\t1\n)\\\.\n
+ /xm,
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ data_only => 1,
+ only_dump_measurement => 1,
+ section_data => 1,
+ only_dump_test_schema => 1,
+ role_parallel => 1,
+ role => 1,
+ },
+ unlike => {
+ binary_upgrade => 1,
+ schema_only => 1,
+ exclude_measurement => 1,
+ only_dump_test_schema => 1,
+ test_schema_plus_large_objects => 1,
+ exclude_measurement => 1,
+ exclude_measurement_data => 1,
},
},
@@ -2943,6 +3210,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -2955,6 +3226,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -2967,6 +3242,10 @@ my %tests = (
section_post_data => 1,
role => 1,
binary_upgrade => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -3002,7 +3281,11 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { binary_upgrade => 1, exclude_dump_test_schema => 1, },
+ unlike => {
+ binary_upgrade => 1,
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_fourth_table_zero_col' => {
@@ -3015,7 +3298,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_fifth_table' => {
@@ -3038,7 +3324,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_sixth_table' => {
@@ -3057,7 +3346,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_seventh_table' => {
@@ -3076,7 +3368,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_table_identity' => {
@@ -3102,7 +3397,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_table_generated' => {
@@ -3119,7 +3417,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_table_generated_child1 (without local columns)' => {
@@ -3136,6 +3437,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -3165,6 +3467,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -3187,7 +3490,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_inheritance_parent' => {
@@ -3205,7 +3511,10 @@ my %tests = (
/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE TABLE test_inheritance_child' => {
@@ -3227,6 +3536,7 @@ my %tests = (
unlike => {
binary_upgrade => 1,
exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
},
},
@@ -3239,7 +3549,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE STATISTICS extended_stats_options' => {
@@ -3251,7 +3564,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER STATISTICS extended_stats_options' => {
@@ -3263,7 +3579,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE STATISTICS extended_stats_expression' => {
@@ -3275,7 +3594,10 @@ my %tests = (
/xms,
like =>
{ %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE SEQUENCE test_table_col1_seq' => {
@@ -3294,7 +3616,10 @@ my %tests = (
only_dump_test_table => 1,
section_pre_data => 1,
},
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE INDEX ON ONLY measurement' => {
@@ -3324,6 +3649,8 @@ my %tests = (
schema_only => 1,
section_post_data => 1,
test_schema_plus_large_objects => 1,
+ only_dump_measurement => 1,
+ exclude_measurement_data => 1,
},
unlike => {
exclude_dump_test_schema => 1,
@@ -3332,6 +3659,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
role => 1,
section_pre_data => 1,
+ exclude_measurement => 1,
},
},
@@ -3345,9 +3673,16 @@ my %tests = (
\QALTER TABLE ONLY dump_test.measurement\E \n^\s+
\QADD CONSTRAINT measurement_pkey PRIMARY KEY (city_id, logdate);\E
/xm,
- like =>
- { %full_runs, %dump_test_schema_runs, section_post_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_post_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ exclude_measurement => 1,
+ },
},
'CREATE INDEX ... ON measurement_y2006_m2' => {
@@ -3358,6 +3693,10 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -3369,6 +3708,11 @@ my %tests = (
%full_runs,
role => 1,
section_post_data => 1,
+ only_dump_measurement => 1,
+ exclude_measurement_data => 1,
+ },
+ unlike => {
+ exclude_measurement => 1,
},
},
@@ -3398,6 +3742,8 @@ my %tests = (
role => 1,
schema_only => 1,
section_post_data => 1,
+ only_dump_measurement => 1,
+ exclude_measurement_data => 1,
},
unlike => {
only_dump_test_schema => 1,
@@ -3406,6 +3752,7 @@ my %tests = (
pg_dumpall_globals_clean => 1,
section_pre_data => 1,
test_schema_plus_large_objects => 1,
+ exclude_measurement => 1,
},
},
@@ -3421,7 +3768,10 @@ my %tests = (
\n\s+\QWITH LOCAL CHECK OPTION;\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
'ALTER VIEW test_view SET DEFAULT' => {
@@ -3432,7 +3782,10 @@ my %tests = (
\QALTER TABLE ONLY dump_test.test_view ALTER COLUMN col1 SET DEFAULT 1;\E/xm,
like =>
{ %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
- unlike => { exclude_dump_test_schema => 1, },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ only_dump_measurement => 1,
+ },
},
# FIXME
@@ -3604,6 +3957,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3619,6 +3973,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3634,6 +3989,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3649,6 +4005,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3678,6 +4035,7 @@ my %tests = (
exclude_dump_test_schema => 1,
exclude_test_table => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3688,11 +4046,16 @@ my %tests = (
TO regress_dump_test_role;',
regexp =>
qr/^\QGRANT SELECT ON TABLE dump_test.measurement TO regress_dump_test_role;\E/m,
- like =>
- { %full_runs, %dump_test_schema_runs, section_pre_data => 1, },
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ exclude_measurement => 1,
},
},
@@ -3710,8 +4073,12 @@ my %tests = (
%full_runs,
role => 1,
section_pre_data => 1,
+ only_dump_measurement => 1,
+ },
+ unlike => {
+ no_privs => 1,
+ exclude_measurement => 1,
},
- unlike => { no_privs => 1, },
},
'GRANT ALL ON LARGE OBJECT ...' => {
@@ -3755,6 +4122,7 @@ my %tests = (
unlike => {
exclude_dump_test_schema => 1,
no_privs => 1,
+ only_dump_measurement => 1,
},
},
@@ -3856,6 +4224,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -3871,6 +4240,7 @@ my %tests = (
binary_upgrade => 1,
exclude_dump_test_schema => 1,
schema_only => 1,
+ only_dump_measurement => 1,
},
},
@@ -3958,6 +4328,7 @@ my %tests = (
only_dump_test_table => 1,
role => 1,
section_pre_data => 1,
+ only_dump_measurement => 1,
},
unlike => { no_privs => 1, },
},
@@ -3996,8 +4367,11 @@ my %tests = (
like => {
%full_runs, %dump_test_schema_runs, section_pre_data => 1,
},
- unlike =>
- { exclude_dump_test_schema => 1, no_table_access_method => 1 },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_table_access_method => 1,
+ only_dump_measurement => 1,
+ },
},
'CREATE MATERIALIZED VIEW regress_pg_dump_matview_am' => {
@@ -4017,8 +4391,11 @@ my %tests = (
like => {
%full_runs, %dump_test_schema_runs, section_pre_data => 1,
},
- unlike =>
- { exclude_dump_test_schema => 1, no_table_access_method => 1 },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ no_table_access_method => 1,
+ only_dump_measurement => 1,
+ },
});
#########################################
Hi Gilles,
V5 is ok (aside for LLVM 14 deprecated warnings, but that's another
problem) with meson compile and meson test on Ubuntu 20.04.2.
Code fits well and looks standart, --help explain what it does clearly, and
documentation is ok (but as a Français, I'm not an expert in English).
Stéphane
Le lun. 13 mars 2023 à 16:15, Gilles Darold <gilles@migops.com> a écrit :
Le 12/03/2023 à 19:05, Stéphane Tachoires a écrit :
Hi Gilles,
On Ubuntu 22.04.2 all deb's updated, I have an error on a test
I'll try to find where and why, but I think you should know first.1/1 postgresql:pg_dump / pg_dump/002_pg_dump ERROR
24.40s exit status 1
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
✀
――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
stderr:
# Failed test 'only_dump_measurement: should dump CREATE TABLE
test_compression'
# at /media/hddisk/stephane/postgresql/src/postgresql/src/bin/pg_dump/t/
002_pg_dump.pl line 4729.
# Review only_dump_measurement results in
/media/hddisk/stephane/postgresql/build/testrun/pg_dump/002_pg_dump/data/tmp_test_iJxJ
# Looks like you failed 1 test of 10264.Hi Stephane,
Odd, I do not have this error when running make installcheck, I have the
same OS version as you.+++ tap check in src/bin/pg_dump +++ t/001_basic.pl ................ ok t/002_pg_dump.pl .............. ok t/003_pg_dump_with_server.pl .. ok t/010_dump_connstr.pl ......... ok All tests successful. Files=4, Tests=9531, 11 wallclock secs ( 0.33 usr 0.04 sys + 3.05 cusr 1.22 csys = 4.64 CPU) Result: PASSAnyway this test must be fixed and this is done in version v5 of the patch
attached here.Thanks for the review.
--
Gilles Darold
--
"Où se posaient les hirondelles avant l'invention du téléphone ?"
-- Grégoire Lacroix
The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: tested, passed
Documentation: tested, passed
V5 is ok (aside for LLVM 14 deprecated warnings, but that's another problem) with meson compile and meson test on Ubuntu 20.04.2.
Code fits well and looks standart, --help explain what it does clearly, and documentation is ok (but as a Français, I'm not an expert in English).
Le 14/03/2023 à 10:50, stephane tachoires a écrit :
The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: tested, passed
Documentation: tested, passedV5 is ok (aside for LLVM 14 deprecated warnings, but that's another problem) with meson compile and meson test on Ubuntu 20.04.2.
Code fits well and looks standart, --help explain what it does clearly, and documentation is ok (but as a Français, I'm not an expert in English).
Thanks Stepane, I've changed commit fest status to "Ready for committers".
--
Gilles Darold