pg_restore -t of a view does an empty data-only restore
От | Craig Ringer |
---|---|
Тема | pg_restore -t of a view does an empty data-only restore |
Дата | |
Msg-id | CAMsr+YGJ50TvTVK4Dbp66gAjeOC0KaP6KXFEHAOM+neQmHvoQA@mail.gmail.com обсуждение исходный текст |
Список | pgsql-bugs |
TL;DR: pg_restore -t should match views too, I'll send a patch. A user reported an issue where they can't selectively restore the schema of a view. The view is ignored by -t, so they get an empty restore. When they pg_restore -t theview -v - d dbname thedump they get: pg_restore: connecting to database for restore pg_restore: implied data-only restore ... and the view is not restored. Omitting the target database shows that pg_restore is just emitting its prelude then an empty body. Looking at the pg_restore source, it's emitting that message from src/bin/pg_dump/pg_backup_archiver.c:404 . It looks like it's scanned the ToC for wanted entries, determined that none have been found, and therefore assumed a data-only restore. It looks like this is by design. -t is stored in opts->tableNames , which is checked in _tocEntryRequired: if (strcmp(te->desc, "TABLE") == 0 || strcmp(te->desc, "TABLE DATA") == 0) { if (!ropt->selTable) return 0; if (ropt->tableNames.head != NULL && (!(simple_string_list_member(&ropt->tableNames, te->tag)))) return 0; } IMO this should also match views, sequences, materialized views, foreign tables, and anything else in pg_class. Elsewhere we treat them all as relations, and they share the same namespace so there's no need to differentiate between them based on object type. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
В списке pgsql-bugs по дате отправления: