Skip site navigation (1) Skip section navigation (2)

Re: Backend-internal SPI operations

From: "Mark Hollomon" <mhh(at)nortelnetworks(dot)com>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jan Wieck <janwieck(at)Yahoo(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Backend-internal SPI operations
Date: 2000-08-30 16:38:27
Message-ID: 39AD3883.FE0F32EF@americasm01.nt.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Mike Mascari wrote:
> 
> Tom Lane wrote:
> >
> > Jan Wieck <janwieck(at)Yahoo(dot)com> writes:
> > >     From  memory  I think views are created as CREATE TABLE, with
> > >     an internal  DefineRuleStmt,  and  dumped  as  CREATE  TABLE,
> > >     CREATE  RULE for sure.  So the CREATE/DROP RULE would need to
> > >     remove/recreate the tables file (plus toast file  and  index)
> > >     if  you want it to be consistent. Don't think you want that -
> > >     do you?
> >
> > But that's only true because it's such a pain in the neck for pg_dump
> > to discover that a table is a view.  If this could easily be told from
> > inspection of pg_class, then it'd be no problem to dump views as
> > CREATE VIEW statements in the first place --- obviously better, no?
> 
> The fact that views can be created by a separate table/rule
> sequence allows pg_dump to properly dump views which are based
> upon functions, or views which may have dependencies on other
> tables/views.

I don't see this. a 'CREATE VIEW' cannot reference a function that
did not exist at the time it was executed. The only way to get in
trouble, that I see, is a DROP/CREATE RULE. But I think
the proposal is not to allow this to happen if the rule is the
select rule for a view.

The reason that pg_dump used the table/rule sequence was that historically
it was hard to figure out that a tuple in pg_class really represented a
view.

But I could be mistaken.


-- 

Mark Hollomon
mhh(at)nortelnetworks(dot)com
ESN 451-9008 (302)454-9008

In response to

Responses

pgsql-hackers by date

Next:From: Tim PerdueDate: 2000-08-30 17:37:23
Subject: Fragged State in 7.0.2
Previous:From: Ross J. ReedstromDate: 2000-08-30 16:35:47
Subject: Re: [HACKERS] when does CREATE VIEW not create a view?

pgsql-patches by date

Next:From: Mark HollomonDate: 2000-08-30 18:29:56
Subject: Re: New relkind for views
Previous:From: Ross J. ReedstromDate: 2000-08-30 16:35:47
Subject: Re: [HACKERS] when does CREATE VIEW not create a view?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group