summaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/dumputils.c
diff options
context:
space:
mode:
authorMagnus Hagander2013-01-17 10:24:47 +0000
committerMagnus Hagander2013-01-17 10:24:47 +0000
commitf3af53441ed0b306692a1cc31003a84d1b5b3cf7 (patch)
treed21b2e0fd1885497eabb8fd294e652cf856b4ad0 /src/bin/pg_dump/dumputils.c
parent36bdfa52a0780d2fcbb48665ab7ca98a13593fdf (diff)
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
Diffstat (limited to 'src/bin/pg_dump/dumputils.c')
-rw-r--r--src/bin/pg_dump/dumputils.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c
index 80bc0c81782..7ca0c60f3e5 100644
--- a/src/bin/pg_dump/dumputils.c
+++ b/src/bin/pg_dump/dumputils.c
@@ -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;
+}