stumped on view/rule/delete problem. - Mailing list pgsql-general

From Pete Leonard
Subject stumped on view/rule/delete problem.
Date
Msg-id Pine.LNX.4.10.10106111411210.29717-100000@hero.com
Whole thread Raw
Responses Re: stumped on view/rule/delete problem.  (Andrew Snow <andrew@modulus.org>)
Re: stumped on view/rule/delete problem.  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: stumped on view/rule/delete problem.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hey folks,

Still learning the ins and outs of postgres, and I'm stumped on this
problem - was hoping someone here could help.

create table foo (
id    serial,
name    varchar(50)
);

create table bar (
foo_id    integer,
name2    varchar(50)
);

create view foobar as
select f.id, f.name, b.name2 from foo f, bar b where (f.id = b.foo_id);


now -

create rule delete_foobar as on delete to foobar
do instead (
delete from foo where id=OLD.id;
delete from bar where foo_id = OLD.id;
);

running the command
delete from foobar where id=1;

causes the DB to hang.  only way out is an immediate restart of the DB.

Needless to say, this isn't the functionality I was looking for.  :)

Postgres v. 7.1, running under FreeBSD.

    thanks,

    --pete



pgsql-general by date:

Previous
From: Paul Tomblin
Date:
Subject: What the heck is happening here?
Next
From: Alex Pilosov
Date:
Subject: Re: What the heck is happening here?