1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Support multiple -t/--table arguments for more commands

On top of the previous support in pg_dump, add support to specify
multiple tables (by using the -t option multiple times) to
pg_restore, clsuterdb, reindexdb and vacuumdb.

Josh Kupershmidt, reviewed by Karl O. Pinc
This commit is contained in:
Magnus Hagander
2013-01-17 11:24:47 +01:00
parent 36bdfa52a0
commit f3af53441e
15 changed files with 191 additions and 111 deletions

View File

@ -17,6 +17,7 @@
#include <ctype.h>
#include "dumputils.h"
#include "dumpmem.h"
#include "parser/keywords.h"
@ -1352,3 +1353,35 @@ exit_nicely(int code)
exit(code);
}
void
simple_string_list_append(SimpleStringList *list, const char *val)
{
SimpleStringListCell *cell;
/* this calculation correctly accounts for the null trailing byte */
cell = (SimpleStringListCell *)
pg_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;
}
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;
}