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

Поиск
Список
Период
Сортировка
От jwieck@debis.com (Jan Wieck)
Тема Re: [HACKERS] Dumping of views -- done!
Дата
Msg-id m0zQ676-000EBQC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на Re: [HACKERS] Dumping of views -- done!  (Terry Mackintosh <terry@terrym.com>)
Ответы Re: [HACKERS] Dumping of views -- done!
Список 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@debis.com (Jan Wieck) #

В списке pgsql-hackers по дате отправления:

Предыдущее
От: jwieck@debis.com (Jan Wieck)
Дата:
Сообщение: Re: [HACKERS] plpgsql is not ready for prime time
Следующее
От: "Hiroshi Inoue"
Дата:
Сообщение: cursors in LLL