Skip site navigation (1) Skip section navigation (2)

Odd rule behavior?

From: Jon Lapham <lapham(at)extracta(dot)com(dot)br>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Odd rule behavior?
Date: 2001-08-30 03:11:11
Message-ID: 3B8DAECF.5080209@extracta.com.br (view raw or flat)
Thread:
Lists: pgsql-hackers
Hello-

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

When running the following script (a stripped-down version of what I'm 
really doing, but it demostrates the behavior):

CREATE TABLE log (logid int4);
CREATE TABLE data (dataid int4);
CREATE RULE r_delete_data
   AS ON DELETE TO data
   DO DELETE FROM log WHERE logid=OLD.dataid;
CREATE RULE r_insert_data
   AS ON INSERT TO data
   DO INSERT INTO log (logid) VALUES (NEW.dataid);
INSERT INTO data (dataid) VALUES (1);
DROP TABLE log;
CREATE TABLE log (logid int4);
DELETE FROM data WHERE dataid=1;

My setup: linux v2.4.9, pg v7.1.2

Is this a bug?  If this is *not* a bug in postgres, then any suggestions 
on the right way to go about rebuilding the "log" table above?  In my 
real application, I've dropped and added some columns to "log" (changes 
such that ALTER TABLE isn't able to help).

TIA, Jon

-- 

-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
  Jon Lapham
  Extracta Mol├ęculas Naturais, Rio de Janeiro, Brasil
  email: lapham(at)extracta(dot)com(dot)br      web: http://www.extracta.com.br/
***-*--*----*-------*------------*--------------------*---------------



Responses

pgsql-hackers by date

Next:From: Horst HerbDate: 2001-08-30 03:40:49
Subject: Re: Re: [SQL] getting the oid for a new tuple in a BEFORE trigger
Previous:From: Rene PijlmanDate: 2001-08-29 22:20:07
Subject: Multiple semicolon separated statements and autocommit

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group