Re: What causes a table's oid to change?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Richard Ray <rray1(at)netdoor(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: What causes a table's oid to change?
Date: 2002-10-09 05:10:52
Message-ID: 17491.1034140252@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Josh Berkus <josh(at)agliodbs(dot)com> writes:
> This is caused by dropping and re-creating the table. Whenever you drop and
> re-created a table, all views based on the table must be dropped and
> re-created as well. Someday, we'll fix this,

7.3 fixes it, if you consider a fix to be disallowing drop of a table
that has dependent views...

regression=# create table t1 (f1 int);
CREATE TABLE
regression=# create view v1 as select * from t1;
CREATE VIEW
regression=# drop table t1;
NOTICE: rule _RETURN on view v1 depends on table t1
NOTICE: view v1 depends on rule _RETURN on view v1
ERROR: Cannot drop table t1 because other objects depend on it
Use DROP ... CASCADE to drop the dependent objects too
regression=# drop table t1 cascade;
NOTICE: Drop cascades to rule _RETURN on view v1
NOTICE: Drop cascades to view v1
DROP TABLE
regression=# select * from v1;
ERROR: Relation "v1" does not exist

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2002-10-09 05:27:20 Re: What causes a table's oid to change?
Previous Message Josh Berkus 2002-10-08 22:58:23 Re: What causes a table's oid to change?