agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v5 1/4] WIP: pg_upgrade/test.sh: changes needed to allow testing upgrade to v14dev from v9.5-v13 8+ messages / 2 participants [nested] [flat]
* [PATCH v5 1/4] WIP: pg_upgrade/test.sh: changes needed to allow testing upgrade to v14dev from v9.5-v13 @ 2020-12-06 04:31 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Justin Pryzby @ 2020-12-06 04:31 UTC (permalink / raw) --- src/bin/pg_upgrade/test.sh | 93 +++++++++++++++++++++++++++++++++++--- 1 file changed, 86 insertions(+), 7 deletions(-) diff --git a/src/bin/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh index 1ba326decd..9288cfdda8 100644 --- a/src/bin/pg_upgrade/test.sh +++ b/src/bin/pg_upgrade/test.sh @@ -176,18 +176,97 @@ if "$MAKE" -C "$oldsrc" installcheck-parallel; then esac fix_sql="$fix_sql DROP FUNCTION IF EXISTS - public.oldstyle_length(integer, text); -- last in 9.6 + public.oldstyle_length(integer, text);" # last in 9.6 -- commit 5ded4bd21 + fix_sql="$fix_sql DROP FUNCTION IF EXISTS - public.putenv(text); -- last in v13 - DROP OPERATOR IF EXISTS -- last in v13 - public.#@# (pg_catalog.int8, NONE), - public.#%# (pg_catalog.int8, NONE), - public.!=- (pg_catalog.int8, NONE), + public.putenv(text);" # last in v13 + # last in v13 commit 76f412ab3 + # public.!=- This one is only needed for v11+ ?? + # Note, until v10, operators could only be dropped one at a time + fix_sql="$fix_sql + DROP OPERATOR IF EXISTS + public.#@# (pg_catalog.int8, NONE);" + fix_sql="$fix_sql + DROP OPERATOR IF EXISTS + public.#%# (pg_catalog.int8, NONE);" + fix_sql="$fix_sql + DROP OPERATOR IF EXISTS + public.!=- (pg_catalog.int8, NONE);" + fix_sql="$fix_sql + DROP OPERATOR IF EXISTS public.#@%# (pg_catalog.int8, NONE);" + + # commit 068503c76511cdb0080bab689662a20e86b9c845 + case $oldpgversion in + 10????) + fix_sql="$fix_sql + DROP TRANSFORM FOR integer LANGUAGE sql CASCADE;" + ;; + esac + + # commit db3af9feb19f39827e916145f88fa5eca3130cb2 + case $oldpgversion in + 10????) + fix_sql="$fix_sql + DROP FUNCTION boxarea(box);" + fix_sql="$fix_sql + DROP FUNCTION funny_dup17();" + ;; + esac + + # commit cda6a8d01d391eab45c4b3e0043a1b2b31072f5f + case $oldpgversion in + 10????) + fix_sql="$fix_sql + DROP TABLE abstime_tbl;" + fix_sql="$fix_sql + DROP TABLE reltime_tbl;" + fix_sql="$fix_sql + DROP TABLE tinterval_tbl;" + ;; + esac + + # Various things removed for v14 + case $oldpgversion in + 906??|10????|11????|12????|13????) + fix_sql="$fix_sql + DROP AGGREGATE first_el_agg_any(anyelement);" + ;; + esac + case $oldpgversion in + 90[56]??|10????|11????|12????|13????) + # commit 9e38c2bb5 and 97f73a978 + # fix_sql="$fix_sql DROP AGGREGATE array_larger_accum(anyarray);" + fix_sql="$fix_sql + DROP AGGREGATE array_cat_accum(anyarray);" + + # commit 76f412ab3 + #fix_sql="$fix_sql DROP OPERATOR @#@(bigint,NONE);" + fix_sql="$fix_sql + DROP OPERATOR @#@(NONE,bigint);" + ;; + esac + + # commit 578b22971: OIDS removed in v12 + case $oldpgversion in + 804??|9????|10????|11????) + fix_sql="$fix_sql + ALTER TABLE public.tenk1 SET WITHOUT OIDS;" + fix_sql="$fix_sql + ALTER TABLE public.tenk1 SET WITHOUT OIDS;" + #fix_sql="$fix_sql ALTER TABLE public.stud_emp SET WITHOUT OIDS;" # inherited + fix_sql="$fix_sql + ALTER TABLE public.emp SET WITHOUT OIDS;" + fix_sql="$fix_sql + ALTER TABLE public.tt7 SET WITHOUT OIDS;" + ;; + esac + psql -X -d regression -c "$fix_sql;" || psql_fix_sql_status=$? fi - pg_dumpall --no-sync -f "$temp_root"/dump1.sql || pg_dumpall1_status=$? + echo "fix_sql: $oldpgversion: $fix_sql" >&2 + pg_dumpall --extra-float-digits=0 --no-sync -f "$temp_root"/dump1.sql || pg_dumpall1_status=$? if [ "$newsrc" != "$oldsrc" ]; then # update references to old source tree's regress.so etc -- 2.17.0 --EuxKj2iCbKjpUGkD Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v5-0002-More-changes-needed-to-allow-upgrade-testing.patch" ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v3 2/4] pg_dump: Add --sequence-data. @ 2025-02-19 17:25 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Nathan Bossart @ 2025-02-19 17:25 UTC (permalink / raw) This new option instructs pg_dump to dump sequence data when the --no-data, --schema-only, or --statistics-only option is specified. This was originally considered for commit a7e5457db8, but it was left out at that time because there was no known use-case. A follow-up commit will use this to optimize pg_upgrade's file transfer step. Discussion: https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan --- doc/src/sgml/ref/pg_dump.sgml | 11 +++++++++++ src/bin/pg_dump/pg_dump.c | 10 ++-------- src/bin/pg_dump/t/002_pg_dump.pl | 1 + src/bin/pg_upgrade/dump.c | 2 +- src/test/modules/test_pg_dump/t/001_base.pl | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 1975054d7bf..b05f16995c3 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1289,6 +1289,17 @@ PostgreSQL documentation </listitem> </varlistentry> + <varlistentry> + <term><option>--sequence-data</option></term> + <listitem> + <para> + Include sequence data in the dump. This is the default behavior except + when <option>--no-data</option>, <option>--schema-only</option>, or + <option>--statistics-only</option> is specified. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--serializable-deferrable</option></term> <listitem> diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 4f4ad2ee150..f63215eb3f9 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -517,6 +517,7 @@ main(int argc, char **argv) {"sync-method", required_argument, NULL, 15}, {"filter", required_argument, NULL, 16}, {"exclude-extension", required_argument, NULL, 17}, + {"sequence-data", no_argument, &dopt.sequence_data, 1}, {NULL, 0, NULL, 0} }; @@ -803,14 +804,6 @@ main(int argc, char **argv) if (dopt.column_inserts && dopt.dump_inserts == 0) dopt.dump_inserts = DUMP_DEFAULT_ROWS_PER_INSERT; - /* - * Binary upgrade mode implies dumping sequence data even in schema-only - * mode. This is not exposed as a separate option, but kept separate - * internally for clarity. - */ - if (dopt.binary_upgrade) - dopt.sequence_data = 1; - if (data_only && schema_only) pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together"); if (schema_only && statistics_only) @@ -1275,6 +1268,7 @@ help(const char *progname) 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(_(" --section=SECTION dump named section (pre-data, data, or post-data)\n")); + 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-only dump only the statistics, not schema or data\n")); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index c7bffc1b045..8ae6c5374fc 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -66,6 +66,7 @@ my %pgdump_runs = ( '--file' => "$tempdir/binary_upgrade.dump", '--no-password', '--no-data', + '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', # alternative way to specify database ], diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c index 23fe7280a16..b8fd0d0acee 100644 --- a/src/bin/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -52,7 +52,7 @@ generate_old_dump(void) snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid); parallel_exec_prog(log_file_name, NULL, - "\"%s/pg_dump\" %s --no-data %s --quote-all-identifiers " + "\"%s/pg_dump\" %s --no-data %s --sequence-data --quote-all-identifiers " "--binary-upgrade --format=custom %s --no-sync --file=\"%s/%s\" %s", new_cluster.bindir, cluster_conn_opts(&old_cluster), log_opts.verbose ? "--verbose" : "", diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl index 9b2a90b0469..27c6c2ab0f3 100644 --- a/src/test/modules/test_pg_dump/t/001_base.pl +++ b/src/test/modules/test_pg_dump/t/001_base.pl @@ -48,7 +48,7 @@ my %pgdump_runs = ( dump_cmd => [ 'pg_dump', '--no-sync', "--file=$tempdir/binary_upgrade.sql", '--schema-only', - '--binary-upgrade', '--dbname=postgres', + '--sequence-data', '--binary-upgrade', '--dbname=postgres', ], }, clean => { -- 2.39.5 (Apple Git-154) --riA+Qo0L+2qqy04o Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v3-0003-Add-new-frontend-functions-for-durable-file-opera.patch" ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v4 2/3] pg_dump: Add --sequence-data. @ 2025-02-19 17:25 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Nathan Bossart @ 2025-02-19 17:25 UTC (permalink / raw) This new option instructs pg_dump to dump sequence data when the --no-data, --schema-only, or --statistics-only option is specified. This was originally considered for commit a7e5457db8, but it was left out at that time because there was no known use-case. A follow-up commit will use this to optimize pg_upgrade's file transfer step. Discussion: https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan --- doc/src/sgml/ref/pg_dump.sgml | 11 +++++++++++ src/bin/pg_dump/pg_dump.c | 10 ++-------- src/bin/pg_dump/t/002_pg_dump.pl | 1 + src/bin/pg_upgrade/dump.c | 2 +- src/test/modules/test_pg_dump/t/001_base.pl | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 1975054d7bf..b05f16995c3 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1289,6 +1289,17 @@ PostgreSQL documentation </listitem> </varlistentry> + <varlistentry> + <term><option>--sequence-data</option></term> + <listitem> + <para> + Include sequence data in the dump. This is the default behavior except + when <option>--no-data</option>, <option>--schema-only</option>, or + <option>--statistics-only</option> is specified. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--serializable-deferrable</option></term> <listitem> diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 4f4ad2ee150..f63215eb3f9 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -517,6 +517,7 @@ main(int argc, char **argv) {"sync-method", required_argument, NULL, 15}, {"filter", required_argument, NULL, 16}, {"exclude-extension", required_argument, NULL, 17}, + {"sequence-data", no_argument, &dopt.sequence_data, 1}, {NULL, 0, NULL, 0} }; @@ -803,14 +804,6 @@ main(int argc, char **argv) if (dopt.column_inserts && dopt.dump_inserts == 0) dopt.dump_inserts = DUMP_DEFAULT_ROWS_PER_INSERT; - /* - * Binary upgrade mode implies dumping sequence data even in schema-only - * mode. This is not exposed as a separate option, but kept separate - * internally for clarity. - */ - if (dopt.binary_upgrade) - dopt.sequence_data = 1; - if (data_only && schema_only) pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together"); if (schema_only && statistics_only) @@ -1275,6 +1268,7 @@ help(const char *progname) 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(_(" --section=SECTION dump named section (pre-data, data, or post-data)\n")); + 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-only dump only the statistics, not schema or data\n")); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index c7bffc1b045..8ae6c5374fc 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -66,6 +66,7 @@ my %pgdump_runs = ( '--file' => "$tempdir/binary_upgrade.dump", '--no-password', '--no-data', + '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', # alternative way to specify database ], diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c index 23fe7280a16..b8fd0d0acee 100644 --- a/src/bin/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -52,7 +52,7 @@ generate_old_dump(void) snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid); parallel_exec_prog(log_file_name, NULL, - "\"%s/pg_dump\" %s --no-data %s --quote-all-identifiers " + "\"%s/pg_dump\" %s --no-data %s --sequence-data --quote-all-identifiers " "--binary-upgrade --format=custom %s --no-sync --file=\"%s/%s\" %s", new_cluster.bindir, cluster_conn_opts(&old_cluster), log_opts.verbose ? "--verbose" : "", diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl index 9b2a90b0469..27c6c2ab0f3 100644 --- a/src/test/modules/test_pg_dump/t/001_base.pl +++ b/src/test/modules/test_pg_dump/t/001_base.pl @@ -48,7 +48,7 @@ my %pgdump_runs = ( dump_cmd => [ 'pg_dump', '--no-sync', "--file=$tempdir/binary_upgrade.sql", '--schema-only', - '--binary-upgrade', '--dbname=postgres', + '--sequence-data', '--binary-upgrade', '--dbname=postgres', ], }, clean => { -- 2.39.5 (Apple Git-154) --4+vVKu84k2Vx9Qwr Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v4-0003-pg_upgrade-Add-swap-for-faster-file-transfer.patch" ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v5 2/3] pg_dump: Add --sequence-data. @ 2025-02-19 17:25 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Nathan Bossart @ 2025-02-19 17:25 UTC (permalink / raw) This new option instructs pg_dump to dump sequence data when the --no-data, --schema-only, or --statistics-only option is specified. This was originally considered for commit a7e5457db8, but it was left out at that time because there was no known use-case. A follow-up commit will use this to optimize pg_upgrade's file transfer step. Discussion: https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan --- doc/src/sgml/ref/pg_dump.sgml | 11 +++++++++++ src/bin/pg_dump/pg_dump.c | 10 ++-------- src/bin/pg_dump/t/002_pg_dump.pl | 1 + src/bin/pg_upgrade/dump.c | 2 +- src/test/modules/test_pg_dump/t/001_base.pl | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 0ae40f9be58..63cca18711a 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1298,6 +1298,17 @@ PostgreSQL documentation </listitem> </varlistentry> + <varlistentry> + <term><option>--sequence-data</option></term> + <listitem> + <para> + Include sequence data in the dump. This is the default behavior except + when <option>--no-data</option>, <option>--schema-only</option>, or + <option>--statistics-only</option> is specified. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--serializable-deferrable</option></term> <listitem> diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 428ed2d60fc..e6253331e27 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -518,6 +518,7 @@ main(int argc, char **argv) {"sync-method", required_argument, NULL, 15}, {"filter", required_argument, NULL, 16}, {"exclude-extension", required_argument, NULL, 17}, + {"sequence-data", no_argument, &dopt.sequence_data, 1}, {NULL, 0, NULL, 0} }; @@ -801,14 +802,6 @@ main(int argc, char **argv) if (dopt.column_inserts && dopt.dump_inserts == 0) dopt.dump_inserts = DUMP_DEFAULT_ROWS_PER_INSERT; - /* - * Binary upgrade mode implies dumping sequence data even in schema-only - * mode. This is not exposed as a separate option, but kept separate - * internally for clarity. - */ - if (dopt.binary_upgrade) - dopt.sequence_data = 1; - if (data_only && schema_only) pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together"); if (schema_only && statistics_only) @@ -1275,6 +1268,7 @@ help(const char *progname) 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(_(" --section=SECTION dump named section (pre-data, data, or post-data)\n")); + 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-only dump only the statistics, not schema or data\n")); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index d281e27aa67..ed379033da7 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -66,6 +66,7 @@ my %pgdump_runs = ( '--file' => "$tempdir/binary_upgrade.dump", '--no-password', '--no-data', + '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', # alternative way to specify database ], diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c index 23fe7280a16..b8fd0d0acee 100644 --- a/src/bin/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -52,7 +52,7 @@ generate_old_dump(void) snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid); parallel_exec_prog(log_file_name, NULL, - "\"%s/pg_dump\" %s --no-data %s --quote-all-identifiers " + "\"%s/pg_dump\" %s --no-data %s --sequence-data --quote-all-identifiers " "--binary-upgrade --format=custom %s --no-sync --file=\"%s/%s\" %s", new_cluster.bindir, cluster_conn_opts(&old_cluster), log_opts.verbose ? "--verbose" : "", diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl index a9bcac4169d..adcaa419616 100644 --- a/src/test/modules/test_pg_dump/t/001_base.pl +++ b/src/test/modules/test_pg_dump/t/001_base.pl @@ -48,7 +48,7 @@ my %pgdump_runs = ( dump_cmd => [ 'pg_dump', '--no-sync', '--file' => "$tempdir/binary_upgrade.sql", - '--schema-only', '--binary-upgrade', + '--schema-only', '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', ], }, -- 2.39.5 (Apple Git-154) --X1/Y3tXYeEOfm9P0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v5-0003-pg_upgrade-Add-swap-for-faster-file-transfer.patch" ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v6 2/3] pg_dump: Add --sequence-data. @ 2025-02-19 17:25 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Nathan Bossart @ 2025-02-19 17:25 UTC (permalink / raw) This new option instructs pg_dump to dump sequence data when the --no-data, --schema-only, or --statistics-only option is specified. This was originally considered for commit a7e5457db8, but it was left out at that time because there was no known use-case. A follow-up commit will use this to optimize pg_upgrade's file transfer step. Discussion: https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan --- doc/src/sgml/ref/pg_dump.sgml | 11 +++++++++++ src/bin/pg_dump/pg_dump.c | 10 ++-------- src/bin/pg_dump/t/002_pg_dump.pl | 1 + src/bin/pg_upgrade/dump.c | 2 +- src/test/modules/test_pg_dump/t/001_base.pl | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 0ae40f9be58..63cca18711a 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1298,6 +1298,17 @@ PostgreSQL documentation </listitem> </varlistentry> + <varlistentry> + <term><option>--sequence-data</option></term> + <listitem> + <para> + Include sequence data in the dump. This is the default behavior except + when <option>--no-data</option>, <option>--schema-only</option>, or + <option>--statistics-only</option> is specified. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--serializable-deferrable</option></term> <listitem> diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 428ed2d60fc..e6253331e27 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -518,6 +518,7 @@ main(int argc, char **argv) {"sync-method", required_argument, NULL, 15}, {"filter", required_argument, NULL, 16}, {"exclude-extension", required_argument, NULL, 17}, + {"sequence-data", no_argument, &dopt.sequence_data, 1}, {NULL, 0, NULL, 0} }; @@ -801,14 +802,6 @@ main(int argc, char **argv) if (dopt.column_inserts && dopt.dump_inserts == 0) dopt.dump_inserts = DUMP_DEFAULT_ROWS_PER_INSERT; - /* - * Binary upgrade mode implies dumping sequence data even in schema-only - * mode. This is not exposed as a separate option, but kept separate - * internally for clarity. - */ - if (dopt.binary_upgrade) - dopt.sequence_data = 1; - if (data_only && schema_only) pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together"); if (schema_only && statistics_only) @@ -1275,6 +1268,7 @@ help(const char *progname) 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(_(" --section=SECTION dump named section (pre-data, data, or post-data)\n")); + 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-only dump only the statistics, not schema or data\n")); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index d281e27aa67..ed379033da7 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -66,6 +66,7 @@ my %pgdump_runs = ( '--file' => "$tempdir/binary_upgrade.dump", '--no-password', '--no-data', + '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', # alternative way to specify database ], diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c index 23fe7280a16..b8fd0d0acee 100644 --- a/src/bin/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -52,7 +52,7 @@ generate_old_dump(void) snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid); parallel_exec_prog(log_file_name, NULL, - "\"%s/pg_dump\" %s --no-data %s --quote-all-identifiers " + "\"%s/pg_dump\" %s --no-data %s --sequence-data --quote-all-identifiers " "--binary-upgrade --format=custom %s --no-sync --file=\"%s/%s\" %s", new_cluster.bindir, cluster_conn_opts(&old_cluster), log_opts.verbose ? "--verbose" : "", diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl index a9bcac4169d..adcaa419616 100644 --- a/src/test/modules/test_pg_dump/t/001_base.pl +++ b/src/test/modules/test_pg_dump/t/001_base.pl @@ -48,7 +48,7 @@ my %pgdump_runs = ( dump_cmd => [ 'pg_dump', '--no-sync', '--file' => "$tempdir/binary_upgrade.sql", - '--schema-only', '--binary-upgrade', + '--schema-only', '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', ], }, -- 2.39.5 (Apple Git-154) --/4djzC0ZDFNHPdW9 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v6-0003-pg_upgrade-Add-swap-for-faster-file-transfer.patch" ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v7 3/4] pg_dump: Add --sequence-data. @ 2025-02-19 17:25 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Nathan Bossart @ 2025-02-19 17:25 UTC (permalink / raw) This new option instructs pg_dump to dump sequence data when the --no-data, --schema-only, or --statistics-only option is specified. This was originally considered for commit a7e5457db8, but it was left out at that time because there was no known use-case. A follow-up commit will use this to optimize pg_upgrade's file transfer step. Discussion: https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan --- doc/src/sgml/ref/pg_dump.sgml | 11 +++++++++++ src/bin/pg_dump/pg_dump.c | 10 ++-------- src/bin/pg_dump/t/002_pg_dump.pl | 1 + src/bin/pg_upgrade/dump.c | 2 +- src/test/modules/test_pg_dump/t/001_base.pl | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 0ae40f9be58..63cca18711a 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1298,6 +1298,17 @@ PostgreSQL documentation </listitem> </varlistentry> + <varlistentry> + <term><option>--sequence-data</option></term> + <listitem> + <para> + Include sequence data in the dump. This is the default behavior except + when <option>--no-data</option>, <option>--schema-only</option>, or + <option>--statistics-only</option> is specified. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--serializable-deferrable</option></term> <listitem> diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 428ed2d60fc..e6253331e27 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -518,6 +518,7 @@ main(int argc, char **argv) {"sync-method", required_argument, NULL, 15}, {"filter", required_argument, NULL, 16}, {"exclude-extension", required_argument, NULL, 17}, + {"sequence-data", no_argument, &dopt.sequence_data, 1}, {NULL, 0, NULL, 0} }; @@ -801,14 +802,6 @@ main(int argc, char **argv) if (dopt.column_inserts && dopt.dump_inserts == 0) dopt.dump_inserts = DUMP_DEFAULT_ROWS_PER_INSERT; - /* - * Binary upgrade mode implies dumping sequence data even in schema-only - * mode. This is not exposed as a separate option, but kept separate - * internally for clarity. - */ - if (dopt.binary_upgrade) - dopt.sequence_data = 1; - if (data_only && schema_only) pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together"); if (schema_only && statistics_only) @@ -1275,6 +1268,7 @@ help(const char *progname) 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(_(" --section=SECTION dump named section (pre-data, data, or post-data)\n")); + 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-only dump only the statistics, not schema or data\n")); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index d281e27aa67..ed379033da7 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -66,6 +66,7 @@ my %pgdump_runs = ( '--file' => "$tempdir/binary_upgrade.dump", '--no-password', '--no-data', + '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', # alternative way to specify database ], diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c index 23fe7280a16..b8fd0d0acee 100644 --- a/src/bin/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -52,7 +52,7 @@ generate_old_dump(void) snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid); parallel_exec_prog(log_file_name, NULL, - "\"%s/pg_dump\" %s --no-data %s --quote-all-identifiers " + "\"%s/pg_dump\" %s --no-data %s --sequence-data --quote-all-identifiers " "--binary-upgrade --format=custom %s --no-sync --file=\"%s/%s\" %s", new_cluster.bindir, cluster_conn_opts(&old_cluster), log_opts.verbose ? "--verbose" : "", diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl index a9bcac4169d..adcaa419616 100644 --- a/src/test/modules/test_pg_dump/t/001_base.pl +++ b/src/test/modules/test_pg_dump/t/001_base.pl @@ -48,7 +48,7 @@ my %pgdump_runs = ( dump_cmd => [ 'pg_dump', '--no-sync', '--file' => "$tempdir/binary_upgrade.sql", - '--schema-only', '--binary-upgrade', + '--schema-only', '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', ], }, -- 2.39.5 (Apple Git-154) --alRlLvGJpBe9wL+1 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v7-0004-pg_upgrade-Add-swap-for-faster-file-transfer.patch" ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v8 3/4] pg_dump: Add --sequence-data. @ 2025-02-19 17:25 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Nathan Bossart @ 2025-02-19 17:25 UTC (permalink / raw) This new option instructs pg_dump to dump sequence data when the --no-data, --schema-only, or --statistics-only option is specified. This was originally considered for commit a7e5457db8, but it was left out at that time because there was no known use-case. A follow-up commit will use this to optimize pg_upgrade's file transfer step. Discussion: https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan --- doc/src/sgml/ref/pg_dump.sgml | 11 +++++++++++ src/bin/pg_dump/pg_dump.c | 10 ++-------- src/bin/pg_dump/t/002_pg_dump.pl | 1 + src/bin/pg_upgrade/dump.c | 2 +- src/test/modules/test_pg_dump/t/001_base.pl | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 0ae40f9be58..63cca18711a 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1298,6 +1298,17 @@ PostgreSQL documentation </listitem> </varlistentry> + <varlistentry> + <term><option>--sequence-data</option></term> + <listitem> + <para> + Include sequence data in the dump. This is the default behavior except + when <option>--no-data</option>, <option>--schema-only</option>, or + <option>--statistics-only</option> is specified. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--serializable-deferrable</option></term> <listitem> diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 428ed2d60fc..e6253331e27 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -518,6 +518,7 @@ main(int argc, char **argv) {"sync-method", required_argument, NULL, 15}, {"filter", required_argument, NULL, 16}, {"exclude-extension", required_argument, NULL, 17}, + {"sequence-data", no_argument, &dopt.sequence_data, 1}, {NULL, 0, NULL, 0} }; @@ -801,14 +802,6 @@ main(int argc, char **argv) if (dopt.column_inserts && dopt.dump_inserts == 0) dopt.dump_inserts = DUMP_DEFAULT_ROWS_PER_INSERT; - /* - * Binary upgrade mode implies dumping sequence data even in schema-only - * mode. This is not exposed as a separate option, but kept separate - * internally for clarity. - */ - if (dopt.binary_upgrade) - dopt.sequence_data = 1; - if (data_only && schema_only) pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together"); if (schema_only && statistics_only) @@ -1275,6 +1268,7 @@ help(const char *progname) 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(_(" --section=SECTION dump named section (pre-data, data, or post-data)\n")); + 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-only dump only the statistics, not schema or data\n")); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index d281e27aa67..ed379033da7 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -66,6 +66,7 @@ my %pgdump_runs = ( '--file' => "$tempdir/binary_upgrade.dump", '--no-password', '--no-data', + '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', # alternative way to specify database ], diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c index 23fe7280a16..b8fd0d0acee 100644 --- a/src/bin/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -52,7 +52,7 @@ generate_old_dump(void) snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid); parallel_exec_prog(log_file_name, NULL, - "\"%s/pg_dump\" %s --no-data %s --quote-all-identifiers " + "\"%s/pg_dump\" %s --no-data %s --sequence-data --quote-all-identifiers " "--binary-upgrade --format=custom %s --no-sync --file=\"%s/%s\" %s", new_cluster.bindir, cluster_conn_opts(&old_cluster), log_opts.verbose ? "--verbose" : "", diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl index a9bcac4169d..adcaa419616 100644 --- a/src/test/modules/test_pg_dump/t/001_base.pl +++ b/src/test/modules/test_pg_dump/t/001_base.pl @@ -48,7 +48,7 @@ my %pgdump_runs = ( dump_cmd => [ 'pg_dump', '--no-sync', '--file' => "$tempdir/binary_upgrade.sql", - '--schema-only', '--binary-upgrade', + '--schema-only', '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', ], }, -- 2.39.5 (Apple Git-154) --hXfPGy3/J5GGHYhH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v8-0004-pg_upgrade-Add-swap-for-faster-file-transfer.patch" ^ permalink raw reply [nested|flat] 8+ messages in thread
* [PATCH v9 2/3] pg_dump: Add --sequence-data. @ 2025-02-19 17:25 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 8+ messages in thread From: Nathan Bossart @ 2025-02-19 17:25 UTC (permalink / raw) This new option instructs pg_dump to dump sequence data when the --no-data, --schema-only, or --statistics-only option is specified. This was originally considered for commit a7e5457db8, but it was left out at that time because there was no known use-case. A follow-up commit will use this to optimize pg_upgrade's file transfer step. Reviewed-by: Greg Sabino Mullane <[email protected]> Reviewed-by: Bruce Momjian <[email protected]> Reviewed-by: Robert Haas <[email protected]> Discussion: https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan --- doc/src/sgml/ref/pg_dump.sgml | 11 +++++++++++ src/bin/pg_dump/pg_dump.c | 10 ++-------- src/bin/pg_dump/t/002_pg_dump.pl | 1 + src/bin/pg_upgrade/dump.c | 2 +- src/test/modules/test_pg_dump/t/001_base.pl | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 0ae40f9be58..63cca18711a 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1298,6 +1298,17 @@ PostgreSQL documentation </listitem> </varlistentry> + <varlistentry> + <term><option>--sequence-data</option></term> + <listitem> + <para> + Include sequence data in the dump. This is the default behavior except + when <option>--no-data</option>, <option>--schema-only</option>, or + <option>--statistics-only</option> is specified. + </para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--serializable-deferrable</option></term> <listitem> diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 428ed2d60fc..e6253331e27 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -518,6 +518,7 @@ main(int argc, char **argv) {"sync-method", required_argument, NULL, 15}, {"filter", required_argument, NULL, 16}, {"exclude-extension", required_argument, NULL, 17}, + {"sequence-data", no_argument, &dopt.sequence_data, 1}, {NULL, 0, NULL, 0} }; @@ -801,14 +802,6 @@ main(int argc, char **argv) if (dopt.column_inserts && dopt.dump_inserts == 0) dopt.dump_inserts = DUMP_DEFAULT_ROWS_PER_INSERT; - /* - * Binary upgrade mode implies dumping sequence data even in schema-only - * mode. This is not exposed as a separate option, but kept separate - * internally for clarity. - */ - if (dopt.binary_upgrade) - dopt.sequence_data = 1; - if (data_only && schema_only) pg_fatal("options -s/--schema-only and -a/--data-only cannot be used together"); if (schema_only && statistics_only) @@ -1275,6 +1268,7 @@ help(const char *progname) 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(_(" --section=SECTION dump named section (pre-data, data, or post-data)\n")); + 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-only dump only the statistics, not schema or data\n")); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index d281e27aa67..ed379033da7 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -66,6 +66,7 @@ my %pgdump_runs = ( '--file' => "$tempdir/binary_upgrade.dump", '--no-password', '--no-data', + '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', # alternative way to specify database ], diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c index 23fe7280a16..b8fd0d0acee 100644 --- a/src/bin/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -52,7 +52,7 @@ generate_old_dump(void) snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid); parallel_exec_prog(log_file_name, NULL, - "\"%s/pg_dump\" %s --no-data %s --quote-all-identifiers " + "\"%s/pg_dump\" %s --no-data %s --sequence-data --quote-all-identifiers " "--binary-upgrade --format=custom %s --no-sync --file=\"%s/%s\" %s", new_cluster.bindir, cluster_conn_opts(&old_cluster), log_opts.verbose ? "--verbose" : "", diff --git a/src/test/modules/test_pg_dump/t/001_base.pl b/src/test/modules/test_pg_dump/t/001_base.pl index a9bcac4169d..adcaa419616 100644 --- a/src/test/modules/test_pg_dump/t/001_base.pl +++ b/src/test/modules/test_pg_dump/t/001_base.pl @@ -48,7 +48,7 @@ my %pgdump_runs = ( dump_cmd => [ 'pg_dump', '--no-sync', '--file' => "$tempdir/binary_upgrade.sql", - '--schema-only', '--binary-upgrade', + '--schema-only', '--sequence-data', '--binary-upgrade', '--dbname' => 'postgres', ], }, -- 2.39.5 (Apple Git-154) --pLR3ODfl/bBGLi7m Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v9-0003-pg_upgrade-Add-swap-for-faster-file-transfer.patch" ^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2025-02-19 17:25 UTC | newest] Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-12-06 04:31 [PATCH v5 1/4] WIP: pg_upgrade/test.sh: changes needed to allow testing upgrade to v14dev from v9.5-v13 Justin Pryzby <[email protected]> 2025-02-19 17:25 [PATCH v6 2/3] pg_dump: Add --sequence-data. Nathan Bossart <[email protected]> 2025-02-19 17:25 [PATCH v7 3/4] pg_dump: Add --sequence-data. Nathan Bossart <[email protected]> 2025-02-19 17:25 [PATCH v8 3/4] pg_dump: Add --sequence-data. Nathan Bossart <[email protected]> 2025-02-19 17:25 [PATCH v9 2/3] pg_dump: Add --sequence-data. Nathan Bossart <[email protected]> 2025-02-19 17:25 [PATCH v3 2/4] pg_dump: Add --sequence-data. Nathan Bossart <[email protected]> 2025-02-19 17:25 [PATCH v4 2/3] pg_dump: Add --sequence-data. Nathan Bossart <[email protected]> 2025-02-19 17:25 [PATCH v5 2/3] pg_dump: Add --sequence-data. Nathan Bossart <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox