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:34:50 |
Message-ID: | 860305.95549.qm@web31810.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
> Please change the field name of B.ctid from hasbandctid to ctid.
> The name should be "ctid" for the driver to detect the field is for versioning.
> A.ctid isn't needed.
It works now! However, I have a question. If I have a view with more than two joined tables will
i need to reference the ctid from each table after the first update statement? Is this even
possible since I have to have unique column names?
View Definition
-----------------------------
CREATE OR REPLACE VIEW public.vhusband (id, ctid, name, tiesize) AS
SELECT
A.id, B.ctid, A.name, B.tiesize
FROM
public.person as A
INNER JOIN
public.husband as B
ON
A.id = B.ID
;
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.ctid
)
;
Successful Log showing commit
-----------------------------
BEGIN;
UPDATE "public"."vhusband"
SET "name"=E'hello44',"tiesize"=52
WHERE "id" = 10
AND "ctid" = E'(0,47)'
SELECT "id","ctid","name","tiesize"
FROM "public"."vhusband"
WHERE "id" = 10
COMMIT
:-)
Regards,
Richard Broersma Jr.
From | Date | Subject | |
---|---|---|---|
Next Message | Hiroshi Inoue | 2006-12-12 02:48:41 | Re: Update-able View linked to Access |
Previous Message | Hiroshi Inoue | 2006-12-12 01:16:04 | Re: Update-able View linked to Access |