Re: pg_restore -t should match views, matviews, and foreign tables - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: pg_restore -t should match views, matviews, and foreign tables
Date
Msg-id CAFj8pRCrus_iH+H3=hT9HYgjVaUKm+62iXaegwxB5JxdNV8kGA@mail.gmail.com
Whole thread Raw
In response to pg_restore -t should match views, matviews, and foreign tables  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
Hi

I am sending a review of this trivial patch.

1.This patch enables the possibility to restore only selected view, mat. view, foreign table or sequence. Currently the option -t works with tables only. All other relation like objects are quietly ignored. With this patch, the check on type is enhanced to allow other types described by pg_class system table. The implementation is trivial:

 +            strcmp(te->desc, "TABLE DATA") == 0 ||
+            strcmp(te->desc, "VIEW") == 0 ||
+            strcmp(te->desc, "FOREIGN TABLE") == 0 ||
+            strcmp(te->desc, "MATERIALIZED VIEW") == 0 ||
+            strcmp(te->desc, "MATERIALIZED VIEW DATA") == 0 ||
+            strcmp(te->desc, "SEQUENCE") == 0)

2. There was not any objections against this patch.
3. There was not any problem with patching and compilation.
4. This feature is good enough documented.

There is opened question, if the related line should be changed? The current text is not 100% accurate, but it is short, and well readable and understandable.

  -S, --superuser=NAME         superuser user name to use for disabling triggers
  -t, --table=NAME             restore named table
  -T, --trigger=NAME           restore named trigger

5. All tests passed

6. There are no tests. But pg_dump related sw has not any tests yet.

I don't see any issues - this patch is really trivial without risks. It is working already on pg_dump side, so the fix on pg_restore side is natural.

Regards

Pavel



2015-04-01 5:01 GMT+02:00 Craig Ringer <craig@2ndquadrant.com>:
Following on from this -bugs post:


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

pgsql-hackers by date:

Previous
From: "Shulgin, Oleksandr"
Date:
Subject: Re: Streaming replication for psycopg2
Next
From: Jeff Janes
Date:
Subject: Re: LWLock deadlock and gdb advice