Following on from this -bugs post: http://www.postgresql.org/message-id/camsr+ygj50tvtvk4dbp66gajeoc0kap6kxfehaom+neqmhv...@mail.gmail.com
this patch adds support for views, foreign tables, and materialised views to the pg_restore -t flag. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
From 0319a7ecbab5c1e85e300d93f674087786be144a Mon Sep 17 00:00:00 2001 From: Craig Ringer <cr...@2ndquadrant.com> Date: Wed, 1 Apr 2015 10:46:29 +0800 Subject: [PATCH] pg_restore -t should select views, matviews, and foreign tables Currently pg_restore's '-t' option selects only tables, not other relations. It should be able to match anything that behaves like a relation in the relation namespace, anything that's interchangable with a table, including: * Normal relations * Views * Materialized views * Foreign tables Sequences are not matched. They're in the relation namespace, but only as an implementation detail. A separate option to selectively dump sequences should be added so that there's no BC break if they later become non-class objects. Indexes are also not matched; again, a different option should be added for them. TOAST tables aren't matched, they're implementation detail. See: http://www.postgresql.org/message-id/camsr+ygj50tvtvk4dbp66gajeoc0kap6kxfehaom+neqmhv...@mail.gmail.com --- src/bin/pg_dump/pg_backup_archiver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index ca427de..75c8515 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -2663,7 +2663,10 @@ _tocEntryRequired(TocEntry *te, teSection curSection, RestoreOptions *ropt) if (ropt->selTypes) { if (strcmp(te->desc, "TABLE") == 0 || - strcmp(te->desc, "TABLE DATA") == 0) + strcmp(te->desc, "TABLE DATA") == 0 || + strcmp(te->desc, "VIEW") == 0 || + strcmp(te->desc, "FOREIGN TABLE") == 0 || + strcmp(te->desc, "MATERIALIZED VIEW") == 0) { if (!ropt->selTable) return 0; -- 2.1.0
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers