Re: What causes a table's oid to change? - Mailing list pgsql-novice

From Tom Lane
Subject Re: What causes a table's oid to change?
Date
Msg-id 17491.1034140252@sss.pgh.pa.us
Whole thread Raw
In response to Re: What causes a table's oid to change?  (Josh Berkus <josh@agliodbs.com>)
Responses Re: What causes a table's oid to change?  ("Josh Berkus" <josh@agliodbs.com>)
List pgsql-novice
Josh Berkus <josh@agliodbs.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

pgsql-novice by date:

Previous
From: Josh Berkus
Date:
Subject: Re: What causes a table's oid to change?
Next
From: Sudheesh Krishnankutty
Date:
Subject: How to store encrypted data into database