Re: Update-able View linked to Access
| От | Richard Broersma Jr | 
|---|---|
| Тема | Re: Update-able View linked to Access | 
| Дата | |
| Msg-id | 860305.95549.qm@web31810.mail.mud.yahoo.com обсуждение исходный текст  | 
		
| Ответ на | Re: Update-able View linked to Access (Hiroshi Inoue <inoue@tpf.co.jp>) | 
| Ответы | 
                	
            		Re: Update-able View linked to Access
            		
            		 | 
		
| Список | 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.
		
	В списке pgsql-odbc по дате отправления: