rules

From: Remigiusz Sokolowski <rems(at)gdansk(dot)sprint(dot)pl>
To: pgsql-sql(at)postgresql(dot)org
Subject: rules
Date: 1999-03-05 11:53:17
Message-ID: Pine.GS4.4.02A.9903051235480.58-100000@netra.gdansk.sprint.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi!
I try to learn how to create rules in postgres, but something goes wrong,
cause nothing happens (or eventually some errors).
I have two tables
create table one (
one_id int4 primary key not null default nextval('schem_seq'),
one_name text,
one_lock text
);

create table many (
many_id int4 primary key not null default
nextval('schem_seq'),
many_onef int4 not null, //this is foreign key equal
to one_id from one table
many_name text,
many_lock text
);

I try to create two rules
-first one on update one_id in one table
CREATE RULE rupd_one AS ON UPDATE TO one
DO UPDATE many
SET many_onef = new.one_id
WHERE many_onef = current.one_id;

-second one on delete record from one table
CREATE RULE rdel_one AS ON DELETE TO one
DO DELETE FROM many
WHERE many_onef = old.one_id;

In short these two seem don't work. I'm not sure of either syntax or some
other errors - psql at first rule don't report any errors, just output
UPDATE 0
and second one usually something like this:
PQexec() -- Request was sent to backend, but backend closed the channel
before responding.
This probably means the backend terminated abnormally before or
while processing the request.
Thanks for any response
Rem
-------------------------------------------------------------------*------------
Remigiusz Sokolowski e-mail: rems(at)gdansk(dot)sprint(dot)pl * *
-----------------------------------------------------------------*****----------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 1999-03-05 15:58:15 Re: [SQL] rules
Previous Message Ing. Roberto Andrade 1999-03-04 19:18:47 Description of lo_import and lo_export