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:
committed by
Daniele Varrazzo
parent
ad00eb181d
commit
ad75dcfbb1
@ -384,6 +384,40 @@ parse_time(const char *value, time_t *time)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Append the given string `val` to the `list` */
|
||||
void
|
||||
simple_string_list_append(SimpleStringList *list, const char *val)
|
||||
{
|
||||
SimpleStringListCell *cell;
|
||||
|
||||
/* this calculation correctly accounts for the null trailing byte */
|
||||
cell = (SimpleStringListCell *)
|
||||
pgut_malloc(sizeof(SimpleStringListCell) + strlen(val));
|
||||
cell->next = NULL;
|
||||
strcpy(cell->val, val);
|
||||
|
||||
if (list->tail)
|
||||
list->tail->next = cell;
|
||||
else
|
||||
list->head = cell;
|
||||
list->tail = cell;
|
||||
}
|
||||
|
||||
/* Test whether `val` is in the given `list` */
|
||||
bool
|
||||
simple_string_list_member(SimpleStringList *list, const char *val)
|
||||
{
|
||||
SimpleStringListCell *cell;
|
||||
|
||||
for (cell = list->head; cell; cell = cell->next)
|
||||
{
|
||||
if (strcmp(cell->val, val) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
prompt_for_password(void)
|
||||
{
|
||||
|
Reference in New Issue
Block a user