From: | Richard Broersma Jr <rabroersma(at)yahoo(dot)com> |
---|---|
To: | Jeff Davis <pgsql(at)j-davis(dot)com> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: feature request for Postgresql Rule system. |
Date: | 2006-12-18 23:40:13 |
Message-ID: | 153739.24547.qm@web31811.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> What I was trying to explain is that all of your statements *are*
> succeeding. A WHERE clause in an UPDATE may match zero or more rows. The
> second UPDATE in your rule matches zero rows.
I see, that makes sense. I guess that my confussion was that update 0 was
not the same as success.
> You need to examine that UPDATE, because it's not doing what you expect.
> Perhaps you have several int fields in each table, and you're comparing
> against the wrong one in the WHERE clause? We need to see your table
> definitions and perhaps some sample content to help you further.
Below is my sample table, update-able view and update rule.
CREATE TABLE public.person(
id integer primary key not null
default
nextval('public.person_seq'),
name varchar(30) unique not null);
CREATE TABLE public.wife(
id integer primary key
references person(id)
on delete cascade,
dresssize integer not null);
CREATE OR REPLACE VIEW public.vwife (id, name, dresssize) AS
SELECT A.id, A.name, B.dresssize
FROM public.person as A
INNER JOIN public.wife as B
ON A.id = B.ID;
CREATE OR REPLACE RULE vwife_update
AS ON UPDATE TO public.vwife
DO INSTEAD
(
UPDATE public.person SET name = NEW.name
WHERE id = OLD.id;
UPDATE public.wife SET dresssize = NEW.dresssize
WHERE id = OLD.id
);
Regards,
Richard Broersma Jr.
From | Date | Subject | |
---|---|---|---|
Next Message | Joshua D. Drake | 2006-12-18 23:47:59 | Let's play bash the search engine |
Previous Message | Richard Broersma Jr | 2006-12-18 23:30:08 | Re: feature request for Postgresql Rule system. |