From: Richard Broersma Jr <rabroersma@yahoo.com>
To: Hiroshi Inoue <inoue@tpf.co.jp>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Update-able View linked to Access
Date: Mon, 11 Dec 2006 17:07:20 -0800 (PST)
Message-ID: <938243.53161.qm@web31814.mail.mud.yahoo.com> (raw)
In-Reply-To: <457DF8DD.6010908@tpf.co.jp>
> 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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: rabroersma@yahoo.com, inoue@tpf.co.jp
Subject: Re: Update-able View linked to Access
In-Reply-To: <938243.53161.qm@web31814.mail.mud.yahoo.com>
References: <457DF8DD.6010908@tpf.co.jp> <938243.53161.qm@web31814.mail.mud.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox