> 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.