Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda85fb4

Browse files
committed
Accept multiple -I, -P, -T and -n options in pg_restore.
We already did this for -t (--table) in 9.3, but missed the other similaroptions. For consistency, allow all of them to be specified multiple times.Unfortunately it's too late to sneak this into 9.3, so commit to masteronly.
1 parente246cfc commitda85fb4

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

‎doc/src/sgml/ref/pg_restore.sgml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@
230230
<term><option>--index=<replaceable class="parameter">index</replaceable></option></term>
231231
<listitem>
232232
<para>
233-
Restore definition of named index only.
233+
Restore definition of named index only. Multiple indexes
234+
may be specified with multiple <option>-I</> switches.
234235
</para>
235236
</listitem>
236237
</varlistentry>
@@ -314,7 +315,8 @@
314315
<term><option>--schema=<replaceable class="parameter">schema</replaceable></option></term>
315316
<listitem>
316317
<para>
317-
Restore only objects that are in the named schema. This can be
318+
Restore only objects that are in the named schema. Multiple schemas
319+
may be specified with multiple <option>-n</> switches. This can be
318320
combined with the <option>-t</option> option to restore just a
319321
specific table.
320322
</para>
@@ -348,7 +350,8 @@
348350
<para>
349351
Restore the named function only. Be careful to spell the function
350352
name and arguments exactly as they appear in the dump file's table
351-
of contents.
353+
of contents. Multiple functions may be specified with multiple
354+
<option>-P</> switches.
352355
</para>
353356
</listitem>
354357
</varlistentry>
@@ -413,7 +416,8 @@
413416
<term><option>--trigger=<replaceable class="parameter">trigger</replaceable></option></term>
414417
<listitem>
415418
<para>
416-
Restore named trigger only.
419+
Restore named trigger only. Multiple triggers may be specified with
420+
multiple <option>-T</> switches.
417421
</para>
418422
</listitem>
419423
</varlistentry>

‎src/bin/pg_dump/pg_backup.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ typedef struct _restoreOptions
129129
intselFunction;
130130
intselTrigger;
131131
intselTable;
132-
char*indexNames;
133-
char*functionNames;
134-
char*schemaNames;
135-
char*triggerNames;
132+
SimpleStringListindexNames;
133+
SimpleStringListfunctionNames;
134+
SimpleStringListschemaNames;
135+
SimpleStringListtriggerNames;
136136
SimpleStringListtableNames;
137137

138138
intuseDB;

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,12 +2456,12 @@ _tocEntryRequired(TocEntry *te, teSection curSection, RestoreOptions *ropt)
24562456
}
24572457

24582458
/* Check options for selective dump/restore */
2459-
if (ropt->schemaNames)
2459+
if (ropt->schemaNames.head!=NULL)
24602460
{
24612461
/* If no namespace is specified, it means all. */
24622462
if (!te->namespace)
24632463
return0;
2464-
if (strcmp(ropt->schemaNames,te->namespace)!=0)
2464+
if (!(simple_string_list_member(&ropt->schemaNames,te->namespace)))
24652465
return0;
24662466
}
24672467

@@ -2479,21 +2479,21 @@ _tocEntryRequired(TocEntry *te, teSection curSection, RestoreOptions *ropt)
24792479
{
24802480
if (!ropt->selIndex)
24812481
return0;
2482-
if (ropt->indexNames&&strcmp(ropt->indexNames,te->tag)!=0)
2482+
if (ropt->indexNames.head!=NULL&&(!(simple_string_list_member(&ropt->indexNames,te->tag))))
24832483
return0;
24842484
}
24852485
elseif (strcmp(te->desc,"FUNCTION")==0)
24862486
{
24872487
if (!ropt->selFunction)
24882488
return0;
2489-
if (ropt->functionNames&&strcmp(ropt->functionNames,te->tag)!=0)
2489+
if (ropt->functionNames.head!=NULL&&(!(simple_string_list_member(&ropt->functionNames,te->tag))))
24902490
return0;
24912491
}
24922492
elseif (strcmp(te->desc,"TRIGGER")==0)
24932493
{
24942494
if (!ropt->selTrigger)
24952495
return0;
2496-
if (ropt->triggerNames&&strcmp(ropt->triggerNames,te->tag)!=0)
2496+
if (ropt->triggerNames.head!=NULL&&(!(simple_string_list_member(&ropt->triggerNames,te->tag))))
24972497
return0;
24982498
}
24992499
else

‎src/bin/pg_dump/pg_restore.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ main(int argc, char **argv)
196196
break;
197197

198198
case'n':/* Dump data for this schema only */
199-
opts->schemaNames=pg_strdup(optarg);
199+
simple_string_list_append(&opts->schemaNames,optarg);
200200
break;
201201

202202
case'O':
@@ -213,17 +213,17 @@ main(int argc, char **argv)
213213
case'P':/* Function */
214214
opts->selTypes=1;
215215
opts->selFunction=1;
216-
opts->functionNames=pg_strdup(optarg);
216+
simple_string_list_append(&opts->functionNames,optarg);
217217
break;
218218
case'I':/* Index */
219219
opts->selTypes=1;
220220
opts->selIndex=1;
221-
opts->indexNames=pg_strdup(optarg);
221+
simple_string_list_append(&opts->indexNames,optarg);
222222
break;
223223
case'T':/* Trigger */
224224
opts->selTypes=1;
225225
opts->selTrigger=1;
226-
opts->triggerNames=pg_strdup(optarg);
226+
simple_string_list_append(&opts->triggerNames,optarg);
227227
break;
228228
case's':/* dump schema only */
229229
opts->schemaOnly=1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp