Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a193cbe

Browse files
committed
Add pg_dumpall --rows-per-insert
Commit 7e413a0 added that option to pg_dump, but neglected to teach pg_dumpall how to pass it along. Repair. Author: Fabien Coelho Reported-by: Peter Eisentraut Reviewed-by: David Rowley Discussion: https://postgr.es/m/45f50c59-ddbb-8cf2-eedb-81003f603528@2ndquadrant.com
1 parent 313f56c commit a193cbe

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,20 @@ PostgreSQL documentation
501501
</listitem>
502502
</varlistentry>
503503

504+
<varlistentry>
505+
<term><option>--rows-per-insert=<replaceable class="parameter">nrows</replaceable></option></term>
506+
<listitem>
507+
<para>
508+
Dump data as <command>INSERT</command> commands (rather than
509+
<command>COPY</command>). Controls the maximum number of rows per
510+
<command>INSERT</command> command. The value specified must be a
511+
number greater than zero. Any error during reloading will cause only
512+
rows that are part of the problematic <command>INSERT</command> to be
513+
lost, rather than the entire table contents.
514+
</para>
515+
</listitem>
516+
</varlistentry>
517+
504518
<varlistentry>
505519
<term><option>--use-set-session-authorization</option></term>
506520
<listitem>

src/bin/pg_dump/pg_dumpall.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ main(int argc, char *argv[])
146146
{"no-sync", no_argument, NULL, 4},
147147
{"no-unlogged-table-data", no_argument, &no_unlogged_table_data, 1},
148148
{"on-conflict-do-nothing", no_argument, &on_conflict_do_nothing, 1},
149+
{"rows-per-insert", required_argument, NULL, 7},
149150

150151
{NULL, 0, NULL, 0}
151152
};
@@ -329,6 +330,11 @@ main(int argc, char *argv[])
329330
simple_string_list_append(&database_exclude_patterns, optarg);
330331
break;
331332

333+
case 7:
334+
appendPQExpBufferStr(pgdumpopts, " --rows-per-insert ");
335+
appendShellString(pgdumpopts, optarg);
336+
break;
337+
332338
default:
333339
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
334340
exit_nicely(1);
@@ -648,6 +654,7 @@ help(void)
648654
printf(_(" --no-unlogged-table-data do not dump unlogged table data\n"));
649655
printf(_(" --on-conflict-do-nothing add ON CONFLICT DO NOTHING to INSERT commands\n"));
650656
printf(_(" --quote-all-identifiers quote all identifiers, even if not key words\n"));
657+
printf(_(" --rows-per-insert=NROWS number of rows per INSERT; implies --inserts\n"));
651658
printf(_(" --use-set-session-authorization\n"
652659
" use SET SESSION AUTHORIZATION commands instead of\n"
653660
" ALTER OWNER commands to set ownership\n"));

0 commit comments

Comments
 (0)