Re: [HACKERS] Dumping of views -- done!

From: jwieck(at)debis(dot)com (Jan Wieck)
To: terry(at)terrym(dot)com (Terry Mackintosh)
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Dumping of views -- done!
Date: 1998-10-05 08:35:27
Message-ID: m0zQ676-000EBQC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Terry Mackintosh wrote:
>
> Hi Bruce
>
> On Sat, 3 Oct 1998, Bruce Momjian wrote:
>
> > > Hi all
> > >
> > > Is it too late to add a feature to pg_dump for 6.4??
>
> > I though we dumped views already. If not, I am inclinded to apply it,
>
> OH, ... well, if it does, I sure would like to know how, I missed it.
>

No we didn't. I just mentioned that it would be possible with
the new rule utility functions.

> > but want to see what others say. I thought Jan was working on this, or
> > was that just rewrite rules? Are you using his code? I know there is
>
> I tryed to stay as much in style with the code that was there as possible.
>

Took a look at the patch. Terry's using the new system view
pg_views for it. But...

> > an item on the Open Items list that talks about this:
> >
> > have psql dump out rules text with new function
> > Is that what this is?
>
> I'm not sure that is the same, what my change does is add:
> CREATE VIEW viewname AS select clause......;
> to the dump file.
>
> I did notice that if used with '-z' it also puts the revoke grant
> statments there too. Not my doing, just nice.
>
> At this time there are no provisions (by me any way) to dump any
> associated update/delete rules on the view. Unless, like -z above, it
> already works?
>
> To the best of my knowlage this feature does not yet exist, if any one
> else is working on it, I don't know.

Not me. But I think I should assist since I'm one of the
rulegurus here on the list.

IMHO the better way would be to dump views as regular CREATE
TABLE statements and just omit the data (views have none).
After all tables are restored and all functions, operators
and operator classes are created, we should dump rules using
the pg_rules view.

The checks in pg_dump if a table is a view rely on the
existence of a rule named _RETtablename. I'll add another
check to rewriteDefine.c making sure that a rewrite rule ON
SELECT follows this convention (rules ON SELECT are now
restricted to view rules at all so it would make sense for
me).

I'll add double quotes around identifiers in the output of
pg_get_ruledef() and pg_get_viewdef().

Terry, would you mind to implement dumping of views again in
the above mentioned way? This would cover rewrite rules at
all. A good place to dump rules would be where triggers get
dumped (if they are dumped at all). Dumping all rules would
automagically turn the formerly created tables into views.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 1998-10-05 10:29:10 cursors in LLL
Previous Message Jan Wieck 1998-10-05 07:28:34 Re: [HACKERS] plpgsql is not ready for prime time