Allow multiple --table options to be specified on the command-line.

Per Issue #18. SimpleStringList code borrowed from pg_dump and a
pending patch to add similar functionality to pg_restore,
clusterdb, vacuumdb, and reindexdb.

The error handling in reorg_one_table() could still be much improved,
so that an error processing a single table doesn't cause pg_reorg to
necessarily bail out and skip further tables, but I'll leave that for
another day.
This commit is contained in:
Josh Kupershmidt
2012-11-06 22:07:46 -07:00
committed by Daniele Varrazzo
parent ad00eb181d
commit ad75dcfbb1
5 changed files with 83 additions and 16 deletions

View File

@ -144,9 +144,12 @@ pgut_setopt(pgut_option *opt, const char *optarg, pgut_optsrc src)
/* high prior value has been set already. */
return;
}
else if (src >= SOURCE_CMDLINE && opt->source >= src)
else if (src >= SOURCE_CMDLINE && opt->source >= src && opt->type != 'l')
{
/* duplicated option in command line */
/* duplicated option in command line -- don't worry if the option
* type is 'l' i.e. SimpleStringList, since we are allowed to have
* multiples of these.
*/
message = "specified only once";
}
else
@ -177,6 +180,10 @@ pgut_setopt(pgut_option *opt, const char *optarg, pgut_optsrc src)
return;
message = "a 32bit signed integer";
break;
case 'l':
message = "a List";
simple_string_list_append(opt->var, optarg);
return;
case 'u':
if (parse_uint32(optarg, opt->var))
return;