pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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:34:50 -0800 (PST)
Message-ID: <860305.95549.qm@web31810.mail.mud.yahoo.com> (raw)
In-Reply-To: <457E02D4.7080506@tpf.co.jp>

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



view thread (9+ messages)  latest in thread

Message-ID: <860305.95549.qm@web31810.mail.mud.yahoo.com>
Permalink:  ../860305.95549.qm@web31810.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/860305.95549.qm@web31810.mail.mud.yahoo.com

 · 

reply

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: <860305.95549.qm@web31810.mail.mud.yahoo.com>
  References: <457E02D4.7080506@tpf.co.jp> <860305.95549.qm@web31810.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