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

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_restore -t should match views, matviews, and foreign tables
Date: 2015-04-09 13:13:54
Message-ID: CAMsr+YH42_Bxf_bSaMpLge=p=VGZwFR6XMAw-RxNT9TW8Y7AXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8 April 2015 at 04:33, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Peter Eisentraut <peter_e(at)gmx(dot)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 Content-Type Size
0001-pg_restore-t-should-select-views-matviews-and-foreig.patch text/x-patch 4.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-04-09 13:17:21 Re: "rejected" vs "returned with feedback" in new CF app
Previous Message Magnus Hagander 2015-04-09 13:09:55 Re: "rejected" vs "returned with feedback" in new CF app