Re: pg_restore -t should match views, matviews, and foreign tables

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_restore -t should match views, matviews, and foreign tables
Date: 2015-06-30 14:46:11
Message-ID: CAFj8pRCrus_iH+H3=hT9HYgjVaUKm+62iXaegwxB5JxdNV8kGA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)2ndquadrant(dot)com>:

> Following on from this -bugs post:
>
>
> http://www.postgresql.org/message-id/CAMsr+YGJ50TvTVK4Dbp66gAjeOC0KaP6KXFEHAOM+neQmHvoQA@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
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2015-06-30 16:05:42 Re: LWLock deadlock and gdb advice
Previous Message Shulgin, Oleksandr 2015-06-30 14:42:44 Re: Streaming replication for psycopg2