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

From Craig Ringer
Subject Re: pg_restore -t should match views, matviews, and foreign tables
Date
Msg-id CAMsr+YH42_Bxf_bSaMpLge=p=VGZwFR6XMAw-RxNT9TW8Y7AXQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_restore -t should match views, matviews, and foreign tables  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers


On 8 April 2015 at 04:33, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Peter Eisentraut <peter_e@gmx.net> writes:
> On 3/31/15 11:01 PM, Craig Ringer wrote:
>> this patch adds support for views, foreign tables, and materialised
>> views to the pg_restore -t flag.

> I think this is a good change.  Any concerns?

Are we happy with pg_dump/pg_restore not distinguishing these objects
by type?  It seems rather analogous to letting ALTER TABLE work on views
etc.  Personally I'm fine with this, but certainly some people have
complained about that approach so far as ALTER is concerned.  (But the
implication would be that we'd need four distinct switches, which is
not an outcome I favor.)


My reasoning was that these are all relations that, as far as SELECT et al are concerned, can be interchangeable.

I guess this is more like the ALTER TABLE case though - if you "pg_restore -t" a view, you don't get the data from any table(s) it depends on. So substituting a table for a view won't be transparent to the user anyway.

I mostly just don't see the point of requiring multiple flags for things that are all in the same namespace. It'll mean new flags each time we add some new object type, more logic in apps that invoke pg_restore, etc, and for what seems like no meaningful gain. We'll just land up with "No table 'viewblah' matched, did you mean -V 'viewblah'? "
 
Also, I think you missed "MATERIALIZED VIEW DATA".

Thanks, amended.
 
Also, shouldn't there be a documentation update?

Yes. Again, amended. 

I've also added mention of materialized views to the pg_dump docs for --table, which omitted them.

(It's rather unfortunate that pg_restore's -t is completely different to pg_dump's -t . Fixing that would involve implementing wildcard search support in pg_restore and would break backward compatibility, though).

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
Attachment

pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: "rejected" vs "returned with feedback" in new CF app
Next
From: Andres Freund
Date:
Subject: Re: "rejected" vs "returned with feedback" in new CF app