1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-11 10:01:57 +03:00

Check existency of table/schema for -t/-n option (pg_dump/pg_restore)

Patch provides command line option --strict-names which requires that at
least one table/schema should present for each -t/-n option.

Pavel Stehule <pavel.stehule@gmail.com>
This commit is contained in:
Teodor Sigaev
2015-09-14 16:19:49 +03:00
parent b5217d6968
commit d02426029b
8 changed files with 161 additions and 34 deletions

View File

@ -1220,6 +1220,7 @@ simple_string_list_append(SimpleStringList *list, const char *val)
pg_malloc(offsetof(SimpleStringListCell, val) +strlen(val) + 1);
cell->next = NULL;
cell->touched = false;
strcpy(cell->val, val);
if (list->tail)
@ -1237,7 +1238,23 @@ simple_string_list_member(SimpleStringList *list, const char *val)
for (cell = list->head; cell; cell = cell->next)
{
if (strcmp(cell->val, val) == 0)
{
cell->touched = true;
return true;
}
}
return false;
}
const char *
simple_string_list_not_touched(SimpleStringList *list)
{
SimpleStringListCell *cell;
for (cell = list->head; cell; cell = cell->next)
{
if (!cell->touched)
return cell->val;
}
return NULL;
}