> Could you try the following ?
> Add the CTID field of the target table of the last update rule to the
> definition of the view. In your case, try to add husband.ctid to the
> definition of vhusband.
I am still getting similar errors, only now both columns are locked.
Here is my new view definition:
--------------------------------
CREATE OR REPLACE VIEW public.vhusband (id, personctid, husbandctid, name, tiesize) AS
SELECT
A.id, A.ctid, B.ctid, A.name, B.tiesize
FROM
public.person as A
INNER JOIN
public.husband as B
ON
A.id = B.ID
;
using OLD.husbandctid
------------------------------------
BEGIN;UPDATE "public"."vhusband"
SET "tiesize"=3
WHERE "id" = 14
AND "personctid" = E'(0,63)'
AND "husbandctid" = E'(0,42)'
AND "name" = E'hel0'
AND "tiesize" = 3
ROLLBACK
------------------------------------
Here is my new update rule:
CREATE OR REPLACE RULE
vhusband_update_person
AS ON UPDATE TO
public.vhusband
DO INSTEAD
(
UPDATE
public.person
SET
name = NEW.name
WHERE
id = OLD.id;
UPDATE
public.husband
SET
tiesize = NEW.tiesize
WHERE
id = OLD.id
AND
ctid = OLD.husbandctid
)
;
using NEW.husbandctid
---------------------------
BEGIN;
UPDATE "public"."vhusband"
SET "name"=E'4'
WHERE "id" = 14
AND "personctid" = E'(0,63)'
AND "husbandctid" = E'(0,42)'
AND "name" = E'hel0'
AND "tiesize" = 3
ROLLBACK
----------------------------
CREATE OR REPLACE RULE
vhusband_update_person
AS ON UPDATE TO
public.vhusband
DO INSTEAD
(
UPDATE
public.person
SET
name = NEW.name
WHERE
id = OLD.id;
UPDATE
public.husband
SET
tiesize = NEW.tiesize
WHERE
id = OLD.id
AND
ctid = new.husbandctid
)
;
Thanks for the help.
Regards,
Richard Broersma Jr.