Re: DROP SCHEMA xxx CASCADE: ERROR: could not open relation with OID yyy

From: strk <strk(at)keybit(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: DROP SCHEMA xxx CASCADE: ERROR: could not open relation with OID yyy
Date: 2011-02-07 14:14:36
Message-ID: 20110207141436.GG34837@keybit.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've uploaded also the script output ( CASCADE traces ) :

http://strk.keybit.net/tmp/could_not_open_relation.sql
http://strk.keybit.net/tmp/could_not_open_relation.log

And realized that the relation oid is the one first
requested for deletion. Ie:

DROP TABLE XXX CASCADE;
..
ERROR: could not open relation with OID XXX:regclass::oid

I've found two ways to avoid the error:

1. Perform the DROP TABLE outside the transaction triggering its creation
2. Avoiding population of the table being dropped (the AddEdge call)

Note that the 'edge_data' table has a foreign key to itself, and the
constraint is initially deferred (may have a role here, I guess ?)

"next_left_edge_exists" FOREIGN KEY (abs_next_left_edge)
REFERENCES.edge_data(edge_id)
DEFERRABLE
INITIALLY DEFERRED,
"next_right_edge_exists" FOREIGN KEY (abs_next_right_edge)
REFERENCES edge_data(edge_id)
DEFERRABLE
INITIALLY DEFERRED

--strk;

() Free GIS & Flash consultant/developer
/\ http://strk.keybit.net/services.html

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message strk 2011-02-07 14:38:59 Re: DROP SCHEMA xxx CASCADE: ERROR: could not open relation with OID yyy
Previous Message strk 2011-02-07 14:03:55 Re: DROP SCHEMA xxx CASCADE: ERROR: could not open relation with OID yyy