Re: Odd rule behavior? - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Odd rule behavior?
Date
Msg-id Pine.LNX.4.30.0108301523380.679-100000@peter.localdomain
Whole thread Raw
In response to Odd rule behavior?  (Jon Lapham <lapham@extracta.com.br>)
List pgsql-hackers
Jon Lapham writes:

> I'm receiving the following error message:
> ERROR:  Relation "log" with OID 3694127 no longer exists

As a general rule, this won't work in PostgreSQL:

CREATE TABLE foo (...);
CREATE RULE bar ... ON foo ...; # view, trigger, etc.
DROP TABLE foo (...);
CREATE TABLE foo (...);

The rule (view, trigger) references the table by oid, not by name.  (This
is a good thing.  Consider what happens when the newly created table has a
totally different structure.)  The correct fix would be to prevent the
DROP TABLE or drop the rule with it, but it hasn't been done yet.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Francesco Casadei
Date:
Subject: Re: [SQL] getting the oid for a new tuple in a BEFORE trigger
Next
From: Stephan Szabo
Date:
Subject: Re: Odd rule behavior?