Skip to content

Commit 3ef151e

Browse files
committed
Fix pg_restore -n option to do what the man page says it does. The
original coding only worked if one of the selTypes restriction options was also given. Per report from Nick Johnson.
1 parent 1cae920 commit 3ef151e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.125 2006/02/14 23:30:43 tgl Exp $
18+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.126 2006/04/12 22:18:48 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -1908,17 +1908,18 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls)
19081908
if (!ropt->create && strcmp(te->desc, "DATABASE") == 0)
19091909
return 0;
19101910

1911-
/* Check if tablename only is wanted */
1911+
/* Check options for selective dump/restore */
1912+
if (ropt->schemaNames)
1913+
{
1914+
/* If no namespace is specified, it means all. */
1915+
if (!te->namespace)
1916+
return 0;
1917+
if (strcmp(ropt->schemaNames, te->namespace) != 0)
1918+
return 0;
1919+
}
1920+
19121921
if (ropt->selTypes)
19131922
{
1914-
if (ropt->schemaNames)
1915-
{
1916-
/* If no namespace is specified, it means all. */
1917-
if (!te->namespace)
1918-
return 0;
1919-
if (strcmp(ropt->schemaNames, te->namespace) != 0)
1920-
return 0;
1921-
}
19221923
if (strcmp(te->desc, "TABLE") == 0 ||
19231924
strcmp(te->desc, "TABLE DATA") == 0)
19241925
{

src/bin/pg_dump/pg_restore.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*
3535
*
3636
* IDENTIFICATION
37-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.76 2006/02/12 06:11:51 momjian Exp $
37+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.77 2006/04/12 22:18:48 tgl Exp $
3838
*
3939
*-------------------------------------------------------------------------
4040
*/
@@ -188,7 +188,6 @@ main(int argc, char **argv)
188188
break;
189189

190190
case 'n': /* Dump data for this schema only */
191-
opts->selTypes = 1;
192191
opts->schemaNames = strdup(optarg);
193192
break;
194193

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy