pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: wieck@debis.com
To: peter@pathwaynet.com
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Problem with Rules
Date: Thu, 22 Jul 1999 18:58:53 +0200 (MET DST)
Message-ID: <m117MBJ-0003kvC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <Pine.LNX.4.10.9907221028560.5288-100000@saxony.pathwaynet.com>

>
> 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) #





view thread (3+ messages)  latest in thread

Message-ID: <m117MBJ-0003kvC@orion.SAPserv.Hamburg.dsh.de>
Permalink:  ../m117MBJ-0003kvC@orion.SAPserv.Hamburg.dsh.de/
Also on:    postgresql.org/message-id/m117MBJ-0003kvC@orion.SAPserv.Hamburg.dsh.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: wieck@debis.com, peter@pathwaynet.com
  Subject: Re: [SQL] Problem with Rules
  In-Reply-To: <m117MBJ-0003kvC@orion.SAPserv.Hamburg.dsh.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox