I can confirm this bug in CVS.
---------------------------------------------------------------------------
Rod Taylor wrote:
-- Start of PGP signed section.
> May have posted this earlier...
>
> It would seem that caching the plans for foreign keys has some unwanted
> side effects.
>
>
> test=# select version();
> version
> ------------------------------------------------------------------------
> PostgreSQL 7.4beta4 on i386-portbld-freebsd4.8, compiled by GCC 2.95.4
> (1 row)
>
> test=#
> test=# create table a (col integer primary key);
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "a_pkey"
> for table "a"
> CREATE TABLE
> test=#
> test=# create table b (col integer primary key references a on update
> cascade on delete cascade);
> NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "b_pkey"
> for table "b"
> CREATE TABLE
> test=#
> test=#
> test=# insert into a values (1);
> INSERT 687978 1
> test=# insert into b values (1);
> INSERT 687979 1
> test=#
> test=# insert into a values (2);
> INSERT 687980 1
> test=# insert into b values (2);
> INSERT 687981 1
> test=#
> test=# delete from a where col = 1;
> DELETE 1
> test=#
> test=# alter table b drop constraint b_pkey;
> ALTER TABLE
> test=#
> test=# delete from a where col = 2;
> ERROR: could not open relation with OID 687972
>
-- End of PGP section, PGP failed!
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square,
Pennsylvania19073