1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-09 17:03:00 +03:00

Simplify options in pg_dump and pg_restore.

Remove redundant options --with-data and --with-schema, and rename
--with-statistics to just --statistics.

Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/f379d0aeefe8effe13302a436bc28f549f09e924.camel@j-davis.com
Backpatch-through: 18
This commit is contained in:
Jeff Davis
2025-08-02 07:51:35 -07:00
parent d0c12b98f2
commit a3e8dc1438
8 changed files with 118 additions and 218 deletions

View File

@@ -1354,6 +1354,15 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>--statistics</option></term>
<listitem>
<para>
Dump statistics.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--statistics-only</option></term>
<listitem>
@@ -1440,33 +1449,6 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-data</option></term>
<listitem>
<para>
Dump data. This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-schema</option></term>
<listitem>
<para>
Dump schema (data definitions). This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-statistics</option></term>
<listitem>
<para>
Dump statistics.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-?</option></term>
<term><option>--help</option></term>
@@ -1682,7 +1664,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
</para>
<para>
If <option>--with-statistics</option> is specified,
If <option>--statistics</option> is specified,
<command>pg_dump</command> will include most optimizer statistics in the
resulting dump file. However, some statistics may not be included, such as
those created explicitly with <xref linkend="sql-createstatistics"/> or

View File

@@ -605,6 +605,15 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--statistics</option></term>
<listitem>
<para>
Dump statistics.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--statistics-only</option></term>
<listitem>
@@ -640,33 +649,6 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-data</option></term>
<listitem>
<para>
Dump data. This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-schema</option></term>
<listitem>
<para>
Dump schema (data definitions). This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-statistics</option></term>
<listitem>
<para>
Dump statistics.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-?</option></term>
<term><option>--help</option></term>
@@ -878,7 +860,7 @@ exclude database <replaceable class="parameter">PATTERN</replaceable>
</para>
<para>
If <option>--with-statistics</option> is specified,
If <option>--statistics</option> is specified,
<command>pg_dumpall</command> will include most optimizer statistics in the
resulting dump file. However, some statistics may not be included, such as
those created explicitly with <xref linkend="sql-createstatistics"/> or

View File

@@ -815,6 +815,16 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>--statistics</option></term>
<listitem>
<para>
Output commands to restore statistics, if the archive contains them.
This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--statistics-only</option></term>
<listitem>
@@ -873,36 +883,6 @@ PostgreSQL documentation
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-data</option></term>
<listitem>
<para>
Output commands to restore data, if the archive contains them.
This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-schema</option></term>
<listitem>
<para>
Output commands to restore schema (data definitions), if the archive
contains them. This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--with-statistics</option></term>
<listitem>
<para>
Output commands to restore statistics, if the archive contains them.
This is the default.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-?</option></term>
<term><option>--help</option></term>

View File

@@ -441,8 +441,6 @@ main(int argc, char **argv)
bool data_only = false;
bool schema_only = false;
bool statistics_only = false;
bool with_data = false;
bool with_schema = false;
bool with_statistics = false;
bool no_data = false;
bool no_schema = false;
@@ -506,6 +504,7 @@ main(int argc, char **argv)
{"section", required_argument, NULL, 5},
{"serializable-deferrable", no_argument, &dopt.serializable_deferrable, 1},
{"snapshot", required_argument, NULL, 6},
{"statistics", no_argument, NULL, 22},
{"statistics-only", no_argument, NULL, 18},
{"strict-names", no_argument, &strict_names, 1},
{"use-set-session-authorization", no_argument, &dopt.use_setsessauth, 1},
@@ -520,9 +519,6 @@ main(int argc, char **argv)
{"no-toast-compression", no_argument, &dopt.no_toast_compression, 1},
{"no-unlogged-table-data", no_argument, &dopt.no_unlogged_table_data, 1},
{"no-sync", no_argument, NULL, 7},
{"with-data", no_argument, NULL, 22},
{"with-schema", no_argument, NULL, 23},
{"with-statistics", no_argument, NULL, 24},
{"on-conflict-do-nothing", no_argument, &dopt.do_nothing, 1},
{"rows-per-insert", required_argument, NULL, 10},
{"include-foreign-data", required_argument, NULL, 11},
@@ -790,14 +786,6 @@ main(int argc, char **argv)
break;
case 22:
with_data = true;
break;
case 23:
with_schema = true;
break;
case 24:
with_statistics = true;
break;
@@ -844,24 +832,17 @@ main(int argc, char **argv)
if (statistics_only && no_statistics)
pg_fatal("options --statistics-only and --no-statistics cannot be used together");
/* reject conflicting "with-" and "no-" options */
if (with_data && no_data)
pg_fatal("options --with-data and --no-data cannot be used together");
if (with_schema && no_schema)
pg_fatal("options --with-schema and --no-schema cannot be used together");
/* reject conflicting "no-" options */
if (with_statistics && no_statistics)
pg_fatal("options --with-statistics and --no-statistics cannot be used together");
pg_fatal("options --statistics and --no-statistics cannot be used together");
/* reject conflicting "-only" and "with-" options */
if (data_only && (with_schema || with_statistics))
/* reject conflicting "-only" options */
if (data_only && with_statistics)
pg_fatal("options %s and %s cannot be used together",
"-a/--data-only", with_schema ? "--with-schema" : "--with-statistics");
if (schema_only && (with_data || with_statistics))
"-a/--data-only", "--statistics");
if (schema_only && with_statistics)
pg_fatal("options %s and %s cannot be used together",
"-s/--schema-only", with_data ? "--with-data" : "--with-statistics");
if (statistics_only && (with_data || with_schema))
pg_fatal("options %s and %s cannot be used together",
"--statistics-only", with_data ? "--with-data" : "--with-schema");
"-s/--schema-only", "--statistics");
if (schema_only && foreign_servers_include_patterns.head != NULL)
pg_fatal("options -s/--schema-only and --include-foreign-data cannot be used together");
@@ -881,9 +862,9 @@ main(int argc, char **argv)
* of the checks above.
*/
dopt.dumpData = ((dopt.dumpData && !schema_only && !statistics_only) ||
(data_only || with_data)) && !no_data;
data_only) && !no_data;
dopt.dumpSchema = ((dopt.dumpSchema && !data_only && !statistics_only) ||
(schema_only || with_schema)) && !no_schema;
schema_only) && !no_schema;
dopt.dumpStatistics = ((dopt.dumpStatistics && !schema_only && !data_only) ||
(statistics_only || with_statistics)) && !no_statistics;
@@ -1326,6 +1307,7 @@ help(const char *progname)
printf(_(" --sequence-data include sequence data in dump\n"));
printf(_(" --serializable-deferrable wait until the dump can run without anomalies\n"));
printf(_(" --snapshot=SNAPSHOT use given snapshot for the dump\n"));
printf(_(" --statistics dump the statistics\n"));
printf(_(" --statistics-only dump only the statistics, not schema or data\n"));
printf(_(" --strict-names require table and/or schema include patterns to\n"
" match at least one entity each\n"));
@@ -1334,9 +1316,6 @@ 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-data dump the data\n"));
printf(_(" --with-schema dump the schema\n"));
printf(_(" --with-statistics dump the statistics\n"));
printf(_("\nConnection options:\n"));
printf(_(" -d, --dbname=DBNAME database to dump\n"));

View File

@@ -105,8 +105,6 @@ static int no_subscriptions = 0;
static int no_toast_compression = 0;
static int no_unlogged_table_data = 0;
static int no_role_passwords = 0;
static int with_data = 0;
static int with_schema = 0;
static int with_statistics = 0;
static int server_version;
static int load_via_partition_root = 0;
@@ -180,11 +178,9 @@ main(int argc, char *argv[])
{"no-sync", no_argument, NULL, 4},
{"no-toast-compression", no_argument, &no_toast_compression, 1},
{"no-unlogged-table-data", no_argument, &no_unlogged_table_data, 1},
{"with-data", no_argument, &with_data, 1},
{"with-schema", no_argument, &with_schema, 1},
{"with-statistics", no_argument, &with_statistics, 1},
{"on-conflict-do-nothing", no_argument, &on_conflict_do_nothing, 1},
{"rows-per-insert", required_argument, NULL, 7},
{"statistics", no_argument, &with_statistics, 1},
{"statistics-only", no_argument, &statistics_only, 1},
{"filter", required_argument, NULL, 8},
{"sequence-data", no_argument, &sequence_data, 1},
@@ -475,12 +471,8 @@ main(int argc, char *argv[])
appendPQExpBufferStr(pgdumpopts, " --no-toast-compression");
if (no_unlogged_table_data)
appendPQExpBufferStr(pgdumpopts, " --no-unlogged-table-data");
if (with_data)
appendPQExpBufferStr(pgdumpopts, " --with-data");
if (with_schema)
appendPQExpBufferStr(pgdumpopts, " --with-schema");
if (with_statistics)
appendPQExpBufferStr(pgdumpopts, " --with-statistics");
appendPQExpBufferStr(pgdumpopts, " --statistics");
if (on_conflict_do_nothing)
appendPQExpBufferStr(pgdumpopts, " --on-conflict-do-nothing");
if (statistics_only)
@@ -712,13 +704,11 @@ help(void)
printf(_(" --quote-all-identifiers quote all identifiers, even if not key words\n"));
printf(_(" --rows-per-insert=NROWS number of rows per INSERT; implies --inserts\n"));
printf(_(" --sequence-data include sequence data in dump\n"));
printf(_(" --statistics dump the statistics\n"));
printf(_(" --statistics-only dump only the statistics, not schema or data\n"));
printf(_(" --use-set-session-authorization\n"
" use SET SESSION AUTHORIZATION commands instead of\n"
" ALTER OWNER commands to set ownership\n"));
printf(_(" --with-data dump the data\n"));
printf(_(" --with-schema dump the schema\n"));
printf(_(" --with-statistics dump the statistics\n"));
printf(_("\nConnection options:\n"));
printf(_(" -d, --dbname=CONNSTR connect using connection string\n"));

View File

@@ -82,8 +82,6 @@ main(int argc, char **argv)
static int no_subscriptions = 0;
static int strict_names = 0;
static int statistics_only = 0;
static int with_data = 0;
static int with_schema = 0;
static int with_statistics = 0;
struct option cmdopts[] = {
@@ -139,9 +137,7 @@ main(int argc, char **argv)
{"no-security-labels", no_argument, &no_security_labels, 1},
{"no-subscriptions", no_argument, &no_subscriptions, 1},
{"no-statistics", no_argument, &no_statistics, 1},
{"with-data", no_argument, &with_data, 1},
{"with-schema", no_argument, &with_schema, 1},
{"with-statistics", no_argument, &with_statistics, 1},
{"statistics", no_argument, &with_statistics, 1},
{"statistics-only", no_argument, &statistics_only, 1},
{"filter", required_argument, NULL, 4},
@@ -373,24 +369,17 @@ main(int argc, char **argv)
if (statistics_only && no_statistics)
pg_fatal("options --statistics-only and --no-statistics cannot be used together");
/* reject conflicting "with-" and "no-" options */
if (with_data && no_data)
pg_fatal("options --with-data and --no-data cannot be used together");
if (with_schema && no_schema)
pg_fatal("options --with-schema and --no-schema cannot be used together");
/* reject conflicting "no-" options */
if (with_statistics && no_statistics)
pg_fatal("options --with-statistics and --no-statistics cannot be used together");
pg_fatal("options --statistics and --no-statistics cannot be used together");
/* reject conflicting "only-" and "with-" options */
if (data_only && (with_schema || with_statistics))
/* reject conflicting "only-" options */
if (data_only && with_statistics)
pg_fatal("options %s and %s cannot be used together",
"-a/--data-only", with_schema ? "--with-schema" : "--with-statistics");
if (schema_only && (with_data || with_statistics))
"-a/--data-only", "--statistics");
if (schema_only && with_statistics)
pg_fatal("options %s and %s cannot be used together",
"-s/--schema-only", with_data ? "--with-data" : "--with-statistics");
if (statistics_only && (with_data || with_schema))
pg_fatal("options %s and %s cannot be used together",
"--statistics-only", with_data ? "--with-data" : "--with-schema");
"-s/--schema-only", "--statistics");
if (data_only && opts->dropSchema)
pg_fatal("options -c/--clean and -a/--data-only cannot be used together");
@@ -415,9 +404,9 @@ main(int argc, char **argv)
* of the checks above.
*/
opts->dumpData = ((opts->dumpData && !schema_only && !statistics_only) ||
(data_only || with_data)) && !no_data;
data_only) && !no_data;
opts->dumpSchema = ((opts->dumpSchema && !data_only && !statistics_only) ||
(schema_only || with_schema)) && !no_schema;
schema_only) && !no_schema;
opts->dumpStatistics = ((opts->dumpStatistics && !schema_only && !data_only) ||
(statistics_only || with_statistics)) && !no_statistics;
@@ -558,6 +547,7 @@ usage(const char *progname)
printf(_(" --no-table-access-method do not restore table access methods\n"));
printf(_(" --no-tablespaces do not restore tablespace assignments\n"));
printf(_(" --section=SECTION restore named section (pre-data, data, or post-data)\n"));
printf(_(" --statistics restore the statistics\n"));
printf(_(" --statistics-only restore only the statistics, not schema or data\n"));
printf(_(" --strict-names require table and/or schema include patterns to\n"
" match at least one entity each\n"));
@@ -565,9 +555,6 @@ usage(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-data restore the data\n"));
printf(_(" --with-schema restore the schema\n"));
printf(_(" --with-statistics restore the statistics\n"));
printf(_("\nConnection options:\n"));
printf(_(" -h, --host=HOSTNAME database server host or socket directory\n"));

View File

@@ -68,7 +68,7 @@ my %pgdump_runs = (
'--no-data',
'--sequence-data',
'--binary-upgrade',
'--with-statistics',
'--statistics',
'--dbname' => 'postgres', # alternative way to specify database
],
restore_cmd => [
@@ -76,7 +76,7 @@ my %pgdump_runs = (
'--format' => 'custom',
'--verbose',
'--file' => "$tempdir/binary_upgrade.sql",
'--with-statistics',
'--statistics',
"$tempdir/binary_upgrade.dump",
],
},
@@ -90,13 +90,13 @@ my %pgdump_runs = (
'--format' => 'custom',
'--compress' => '1',
'--file' => "$tempdir/compression_gzip_custom.dump",
'--with-statistics',
'--statistics',
'postgres',
],
restore_cmd => [
'pg_restore',
'--file' => "$tempdir/compression_gzip_custom.sql",
'--with-statistics',
'--statistics',
"$tempdir/compression_gzip_custom.dump",
],
command_like => {
@@ -119,7 +119,7 @@ my %pgdump_runs = (
'--format' => 'directory',
'--compress' => 'gzip:1',
'--file' => "$tempdir/compression_gzip_dir",
'--with-statistics',
'--statistics',
'postgres',
],
# Give coverage for manually compressed blobs.toc files during
@@ -137,7 +137,7 @@ my %pgdump_runs = (
'pg_restore',
'--jobs' => '2',
'--file' => "$tempdir/compression_gzip_dir.sql",
'--with-statistics',
'--statistics',
"$tempdir/compression_gzip_dir",
],
},
@@ -150,7 +150,7 @@ my %pgdump_runs = (
'--format' => 'plain',
'--compress' => '1',
'--file' => "$tempdir/compression_gzip_plain.sql.gz",
'--with-statistics',
'--statistics',
'postgres',
],
# Decompress the generated file to run through the tests.
@@ -169,13 +169,13 @@ my %pgdump_runs = (
'--format' => 'custom',
'--compress' => 'lz4',
'--file' => "$tempdir/compression_lz4_custom.dump",
'--with-statistics',
'--statistics',
'postgres',
],
restore_cmd => [
'pg_restore',
'--file' => "$tempdir/compression_lz4_custom.sql",
'--with-statistics',
'--statistics',
"$tempdir/compression_lz4_custom.dump",
],
command_like => {
@@ -198,7 +198,7 @@ my %pgdump_runs = (
'--format' => 'directory',
'--compress' => 'lz4:1',
'--file' => "$tempdir/compression_lz4_dir",
'--with-statistics',
'--statistics',
'postgres',
],
# Verify that data files were compressed
@@ -210,7 +210,7 @@ my %pgdump_runs = (
'pg_restore',
'--jobs' => '2',
'--file' => "$tempdir/compression_lz4_dir.sql",
'--with-statistics',
'--statistics',
"$tempdir/compression_lz4_dir",
],
},
@@ -223,7 +223,7 @@ my %pgdump_runs = (
'--format' => 'plain',
'--compress' => 'lz4',
'--file' => "$tempdir/compression_lz4_plain.sql.lz4",
'--with-statistics',
'--statistics',
'postgres',
],
# Decompress the generated file to run through the tests.
@@ -245,13 +245,13 @@ my %pgdump_runs = (
'--format' => 'custom',
'--compress' => 'zstd',
'--file' => "$tempdir/compression_zstd_custom.dump",
'--with-statistics',
'--statistics',
'postgres',
],
restore_cmd => [
'pg_restore',
'--file' => "$tempdir/compression_zstd_custom.sql",
'--with-statistics',
'--statistics',
"$tempdir/compression_zstd_custom.dump",
],
command_like => {
@@ -273,7 +273,7 @@ my %pgdump_runs = (
'--format' => 'directory',
'--compress' => 'zstd:1',
'--file' => "$tempdir/compression_zstd_dir",
'--with-statistics',
'--statistics',
'postgres',
],
# Give coverage for manually compressed blobs.toc files during
@@ -294,7 +294,7 @@ my %pgdump_runs = (
'pg_restore',
'--jobs' => '2',
'--file' => "$tempdir/compression_zstd_dir.sql",
'--with-statistics',
'--statistics',
"$tempdir/compression_zstd_dir",
],
},
@@ -308,7 +308,7 @@ my %pgdump_runs = (
'--format' => 'plain',
'--compress' => 'zstd:long',
'--file' => "$tempdir/compression_zstd_plain.sql.zst",
'--with-statistics',
'--statistics',
'postgres',
],
# Decompress the generated file to run through the tests.
@@ -327,7 +327,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/clean.sql",
'--clean',
'--with-statistics',
'--statistics',
'--dbname' => 'postgres', # alternative way to specify database
],
},
@@ -338,7 +338,7 @@ my %pgdump_runs = (
'--clean',
'--if-exists',
'--encoding' => 'UTF8', # no-op, just for testing
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -357,7 +357,7 @@ my %pgdump_runs = (
'--create',
'--no-reconnect', # no-op, just for testing
'--verbose',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -376,7 +376,7 @@ my %pgdump_runs = (
dump_cmd => [
'pg_dump', '--no-sync',
'--file' => "$tempdir/defaults.sql",
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -385,7 +385,7 @@ my %pgdump_runs = (
dump_cmd => [
'pg_dump', '--no-sync',
'--file' => "$tempdir/defaults_no_public.sql",
'--with-statistics',
'--statistics',
'regress_pg_dump_test',
],
},
@@ -395,7 +395,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--clean',
'--file' => "$tempdir/defaults_no_public_clean.sql",
'--with-statistics',
'--statistics',
'regress_pg_dump_test',
],
},
@@ -404,7 +404,7 @@ my %pgdump_runs = (
dump_cmd => [
'pg_dump', '--no-sync',
'--file' => "$tempdir/defaults_public_owner.sql",
'--with-statistics',
'--statistics',
'regress_public_owner',
],
},
@@ -419,14 +419,14 @@ my %pgdump_runs = (
'pg_dump',
'--format' => 'custom',
'--file' => "$tempdir/defaults_custom_format.dump",
'--with-statistics',
'--statistics',
'postgres',
],
restore_cmd => [
'pg_restore',
'--format' => 'custom',
'--file' => "$tempdir/defaults_custom_format.sql",
'--with-statistics',
'--statistics',
"$tempdir/defaults_custom_format.dump",
],
command_like => {
@@ -451,14 +451,14 @@ my %pgdump_runs = (
'pg_dump',
'--format' => 'directory',
'--file' => "$tempdir/defaults_dir_format",
'--with-statistics',
'--statistics',
'postgres',
],
restore_cmd => [
'pg_restore',
'--format' => 'directory',
'--file' => "$tempdir/defaults_dir_format.sql",
'--with-statistics',
'--statistics',
"$tempdir/defaults_dir_format",
],
command_like => {
@@ -484,13 +484,13 @@ my %pgdump_runs = (
'--format' => 'directory',
'--jobs' => 2,
'--file' => "$tempdir/defaults_parallel",
'--with-statistics',
'--statistics',
'postgres',
],
restore_cmd => [
'pg_restore',
'--file' => "$tempdir/defaults_parallel.sql",
'--with-statistics',
'--statistics',
"$tempdir/defaults_parallel",
],
},
@@ -502,14 +502,14 @@ my %pgdump_runs = (
'pg_dump',
'--format' => 'tar',
'--file' => "$tempdir/defaults_tar_format.tar",
'--with-statistics',
'--statistics',
'postgres',
],
restore_cmd => [
'pg_restore',
'--format' => 'tar',
'--file' => "$tempdir/defaults_tar_format.sql",
'--with-statistics',
'--statistics',
"$tempdir/defaults_tar_format.tar",
],
},
@@ -518,7 +518,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/exclude_dump_test_schema.sql",
'--exclude-schema' => 'dump_test',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -527,7 +527,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/exclude_test_table.sql",
'--exclude-table' => 'dump_test.test_table',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -536,7 +536,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/exclude_measurement.sql",
'--exclude-table-and-children' => 'dump_test.measurement',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -546,7 +546,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/exclude_measurement_data.sql",
'--exclude-table-data-and-children' => 'dump_test.measurement',
'--no-unlogged-table-data',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -556,7 +556,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/exclude_test_table_data.sql",
'--exclude-table-data' => 'dump_test.test_table',
'--no-unlogged-table-data',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -575,7 +575,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/pg_dumpall_globals.sql",
'--globals-only',
'--no-sync',
'--with-statistics',
'--statistics',
],
},
pg_dumpall_globals_clean => {
@@ -585,14 +585,14 @@ my %pgdump_runs = (
'--globals-only',
'--clean',
'--no-sync',
'--with-statistics',
'--statistics',
],
},
pg_dumpall_dbprivs => {
dump_cmd => [
'pg_dumpall', '--no-sync',
'--file' => "$tempdir/pg_dumpall_dbprivs.sql",
'--with-statistics',
'--statistics',
],
},
pg_dumpall_exclude => {
@@ -602,7 +602,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/pg_dumpall_exclude.sql",
'--exclude-database' => '*dump_test*',
'--no-sync',
'--with-statistics',
'--statistics',
],
},
no_toast_compression => {
@@ -610,7 +610,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/no_toast_compression.sql",
'--no-toast-compression',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -619,7 +619,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/no_large_objects.sql",
'--no-large-objects',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -628,7 +628,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/no_policies.sql",
'--no-policies',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -637,7 +637,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/no_privs.sql",
'--no-privileges',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -646,7 +646,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/no_owner.sql",
'--no-owner',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -655,7 +655,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/no_table_access_method.sql",
'--no-table-access-method',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -664,7 +664,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/only_dump_test_schema.sql",
'--schema' => 'dump_test',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -675,7 +675,7 @@ my %pgdump_runs = (
'--table' => 'dump_test.test_table',
'--lock-wait-timeout' =>
(1000 * $PostgreSQL::Test::Utils::timeout_default),
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -686,7 +686,7 @@ my %pgdump_runs = (
'--table-and-children' => 'dump_test.measurement',
'--lock-wait-timeout' =>
(1000 * $PostgreSQL::Test::Utils::timeout_default),
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -696,7 +696,7 @@ my %pgdump_runs = (
'--file' => "$tempdir/role.sql",
'--role' => 'regress_dump_test_role',
'--schema' => 'dump_test_second_schema',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -709,13 +709,13 @@ my %pgdump_runs = (
'--file' => "$tempdir/role_parallel",
'--role' => 'regress_dump_test_role',
'--schema' => 'dump_test_second_schema',
'--with-statistics',
'--statistics',
'postgres',
],
restore_cmd => [
'pg_restore',
'--file' => "$tempdir/role_parallel.sql",
'--with-statistics',
'--statistics',
"$tempdir/role_parallel",
],
},
@@ -744,7 +744,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/section_pre_data.sql",
'--section' => 'pre-data',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -753,7 +753,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/section_data.sql",
'--section' => 'data',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -762,7 +762,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
'--file' => "$tempdir/section_post_data.sql",
'--section' => 'post-data',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -773,7 +773,7 @@ my %pgdump_runs = (
'--schema' => 'dump_test',
'--large-objects',
'--no-large-objects',
'--with-statistics',
'--statistics',
'postgres',
],
},
@@ -789,7 +789,7 @@ my %pgdump_runs = (
'pg_dump', '--no-sync',
"--file=$tempdir/no_data_no_schema.sql", '--no-data',
'--no-schema', 'postgres',
'--with-statistics',
'--statistics',
],
},
statistics_only => {
@@ -803,7 +803,7 @@ my %pgdump_runs = (
dump_cmd => [
'pg_dump', '--no-sync',
"--file=$tempdir/no_schema.sql", '--no-schema',
'--with-statistics', 'postgres',
'--statistics', 'postgres',
],
},);
@@ -5204,10 +5204,10 @@ command_fails_like(
'--port' => $port,
'--strict-names',
'--schema-only',
'--with-statistics',
'--statistics',
],
qr/\Qpg_dump: error: options -s\/--schema-only and --with-statistics cannot be used together\E/,
'cannot use --schema-only and --with-statistics together');
qr/\Qpg_dump: error: options -s\/--schema-only and --statistics cannot be used together\E/,
'cannot use --schema-only and --statistics together');
command_fails_like(
[

View File

@@ -58,7 +58,7 @@ generate_old_dump(void)
(user_opts.transfer_mode == TRANSFER_MODE_SWAP) ?
"" : "--sequence-data",
log_opts.verbose ? "--verbose" : "",
user_opts.do_statistics ? "--with-statistics" : "--no-statistics",
user_opts.do_statistics ? "--statistics" : "--no-statistics",
log_opts.dumpdir,
sql_file_name, escaped_connstr.data);