Received: from orion.SAPserv.Hamburg.dsh.de (Tpolaris2.sapham.debis.de [53.2.131.8]) by hub.org (8.9.3/8.9.3) with SMTP id MAA27990 for ; Thu, 22 Jul 1999 12:56:18 -0400 (EDT) (envelope-from wieck@debis.com) Received: by orion.SAPserv.Hamburg.dsh.de for pgsql-sql@postgreSQL.org id m117MBJ-0003kvC; Thu, 22 Jul 99 18:58 MET DST Message-Id: From: wieck@debis.com (Jan Wieck) Subject: Re: [SQL] Problem with Rules To: peter@pathwaynet.com (Peter Eisentraut) Date: Thu, 22 Jul 1999 18:58:53 +0200 (MET DST) Cc: pgsql-sql@postgreSQL.org Reply-To: jwieck@debis.com (Jan Wieck) In-Reply-To: from "Peter Eisentraut" at Jul 22, 99 10:35:59 am X-Mailer: ELM [version 2.4 PL25] Content-Type: text > > I am trying to create some rules for referential integrity. A generic > example: > > test=> create table one (id int4, name text); > > test=> create table two (ref int4, descr text); > > So lets say the "ref" references the "id" and I want to ensure update and > delete cascade when table "one" is modified: > > test=> create rule one_delete_cascade as on delete to one do delete from > two where ref = current.id; > ERROR: current: Table does not exist. > > test=> create rule one_update_cascade as on update to one do update two > set ref=new.id where ref=current.id; > ERROR: current: Table does not exist. > > Apparently, it recognizes the "new" pseudo-instance but not the "current" > one. Please don't tell me "current" is not yet implemented. > > > test=> select version(); > version > -------------------------------------------------------------- > PostgreSQL 6.5.0 on i686-pc-linux-gnu, compiled by gcc 2.7.2.3 CURRENT has been replaced by OLD in v6.4 but still supported. It has been removed in v6.5 so you have to use OLD now. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #========================================= wieck@debis.com (Jan Wieck) #