Re: Update-able View linked to Access

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Update-able View linked to Access
Date: 2006-12-12 01:07:20
Message-ID: 938243.53161.qm@web31814.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

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

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Hiroshi Inoue 2006-12-12 01:16:04 Re: Update-able View linked to Access
Previous Message Hiroshi Inoue 2006-12-12 00:33:33 Re: Update-able View linked to Access