diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-12 22:19:01 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-12 22:19:01 +0000 |
commit | e4b8253c40cd066f9e495ca4b5a19e730797f903 (patch) | |
tree | 26189c63c3bc7083ddfeb1e963ae08796a0af471 /src | |
parent | a5884d5dc84b7af3f00b10dc7a8a1bb62843891c (diff) | |
download | postgresql-e4b8253c40cd066f9e495ca4b5a19e730797f903.tar.gz postgresql-e4b8253c40cd066f9e495ca4b5a19e730797f903.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 24 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_restore.c | 3 |
2 files changed, 14 insertions, 13 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 61b0dee4cbf..aa698e73726 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.117.2.2 2006/02/05 20:58:57 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.117.2.3 2006/04/12 22:19:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1883,18 +1883,20 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt, bool include_acls) if (!ropt->create && strcmp(te->desc, "DATABASE") == 0) return 0; - /* Check if tablename only is wanted */ + /* Check options for selective dump/restore */ + if (ropt->schemaNames) + { + /* If no namespace is specified, it means all. */ + if (!te->namespace) + return 0; + if (strcmp(ropt->schemaNames, te->namespace) != 0) + return 0; + } + if (ropt->selTypes) { - if (ropt->schemaNames) - { - /* If no namespace is specified, it means all. */ - if (!te->namespace) - return 0; - if (strcmp(ropt->schemaNames, te->namespace) != 0) - return 0; - } - if ((strcmp(te->desc, "TABLE") == 0) || (strcmp(te->desc, "TABLE DATA") == 0)) + if (strcmp(te->desc, "TABLE") == 0 || + strcmp(te->desc, "TABLE DATA") == 0) { if (!ropt->selTable) return 0; diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index c40ee7bbec0..95c481e89a9 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -34,7 +34,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.73 2005/10/15 02:49:39 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.73.2.1 2006/04/12 22:19:01 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -224,7 +224,6 @@ main(int argc, char **argv) break; case 'n': /* Dump data for this schema only */ - opts->selTypes = 1; opts->schemaNames = strdup(optarg); break; |