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

Problems with rules

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Problems with rules
Date: 2000-11-14 09:20:55
Message-ID: 200011140920.eAE9Ktv66402@hub.org (view raw or flat)
Thread:
Lists: pgsql-bugs
Carsten Zerbst (zerbst(at)tu-harburg(dot)de) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Problems with rules

Long Description
The given code is destilled from a reallife DB. All attempts to define a rule which automatically updates the column aenderungsdatum from table mitglieder on updates failed. The result was every time 

psql:ruleerror:17: ERROR:  query rewritten 10 times, may contain cycles


Sample Code
DROP TABLE "mitglieder";
CREATE TABLE "mitglieder" (
        "mitid" int4 PRIMARY KEY,
        "name" character varying(100) NOT NULL,
        "vorname" character varying(100),
        "aenderungsdatum" date DEFAULT 'now'
);

INSERT INTO "mitglieder" (mitid, name, vorname) 
         VALUES (42,'Surname','firstname');

DROP RULE "test";
CREATE RULE "test" AS
  ON UPDATE TO "mitglieder" WHERE OLD.name <> NEW.name
  DO UPDATE "mitglieder" SET "aenderungsdatum" = 'now' ;
  
UPDATE "mitglieder" SET name='Nachname' where mitid=42;


No file was uploaded with this report


Responses

pgsql-bugs by date

Next:From: pgsql-bugsDate: 2000-11-14 09:39:24
Subject: NT Binary V7.0 - postgres fails start cause PG_VERSION
Previous:From: pgsql-bugsDate: 2000-11-14 06:58:56
Subject: no way in LargeObject API to detect short read?

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