Problem with Rules

From: Peter Eisentraut <peter(at)pathwaynet(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Problem with Rules
Date: 1999-07-22 14:35:59
Message-ID: Pine.LNX.4.10.9907221028560.5288-100000@saxony.pathwaynet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Thanks.

--
Peter Eisentraut
PathWay Computing, Inc.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 1999-07-22 16:58:53 Re: [SQL] Problem with Rules
Previous Message Ramn Yago 1999-07-22 14:22:16 Problem with large binary objects and Delphi