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

Re: Backend-internal SPI operations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jan Wieck <janwieck(at)Yahoo(dot)com>
Cc: Mark Hollomon <mhh(at)nortelnetworks(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Backend-internal SPI operations
Date: 2000-08-30 15:05:53
Message-ID: 19786.967647953@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
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?

However the initial version upgrade would be a problem, since dump
files out of existing releases would contain CREATE TABLE & RULE
commands instead of CREATE VIEW.  I guess what would happen is that
views reloaded that way wouldn't really be views, they'd be tables
with rules attached.  Grumble.

How about this:
	CREATE RULE of an on-select-instead rule changes table's
	relkind to 'view'.  We don't need to drop the underlying
	table file, though (just leave it be, it'll go away at
	next initdb).

	DROP RULE of a view's on-select-instead is not allowed.
	You have to drop the whole view instead.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Jan WieckDate: 2000-08-30 15:42:47
Subject: Re: Backend-internal SPI operations
Previous:From: Mark HollomonDate: 2000-08-30 14:45:29
Subject: Re: Backend-internal SPI operations

pgsql-patches by date

Next:From: Jan WieckDate: 2000-08-30 15:42:47
Subject: Re: Backend-internal SPI operations
Previous:From: Mark HollomonDate: 2000-08-30 14:45:29
Subject: Re: Backend-internal SPI operations

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