X-Original-To: pgsql-odbc-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 6283F9FA376 for ; Wed, 6 Sep 2006 08:05:27 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 87170-02-4 for ; Wed, 6 Sep 2006 11:05:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 0CEE39FB2BB for ; Wed, 6 Sep 2006 08:05:09 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from astra.telenet-ops.be (astra.telenet-ops.be [195.130.132.58]) by svr4.postgresql.org (Postfix) with ESMTP id CC7065AF8B6 for ; Wed, 6 Sep 2006 11:05:02 +0000 (GMT) Received: from localhost (localhost.localdomain [127.0.0.1]) by astra.telenet-ops.be (Postfix) with SMTP id AA1B8380FA for ; Wed, 6 Sep 2006 13:04:53 +0200 (CEST) Received: from smtp.vialila.lan (d51526810.access.telenet.be [81.82.104.16]) by astra.telenet-ops.be (Postfix) with ESMTP id 698E2380C4 for ; Wed, 6 Sep 2006 13:04:53 +0200 (CEST) Received: from localhost (aragorn [127.0.0.1]) by smtp.vialila.lan (Postfix) with ESMTP id 94E636A49 for ; Wed, 6 Sep 2006 13:04:50 +0200 (CEST) Received: from smtp.vialila.lan ([127.0.0.1]) by localhost (aragorn [127.0.0.1]) (amavisd-new, port 10025) with LMTP id 30786-06 for ; Wed, 6 Sep 2006 13:04:49 +0200 (CEST) Received: from legolas.vialila.lan (legolas.vialila.lan [192.168.93.4]) by smtp.vialila.lan (Postfix) with ESMTP id 537365F49 for ; Wed, 6 Sep 2006 13:04:49 +0200 (CEST) From: Geert Janssens Organization: Kobalt W.I.T. To: pgsql-odbc@postgresql.org Subject: Re: Ms Access 2000 - Update/Delete fails with Write conflict Date: Wed, 6 Sep 2006 13:04:51 +0200 User-Agent: KMail/1.9.4 References: <200609051917.46597.info@kobaltwit.be> In-Reply-To: <200609051917.46597.info@kobaltwit.be> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200609061304.51657.info@kobaltwit.be> X-Virus-Scanned: amavisd-new at vialila.lan X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.135 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200609/38 X-Sequence-Number: 8189 I found my problem, thanks to the suggestions made by Greg Campbell: I hadrow versioning was enabled in ODBC, but in order for Ms Access to use it, I had to remove and relink all the ODBC linked tables. Thank you very much for your help and suggestions ! Regards, Geert On Tuesday 05 September 2006 19:17, Geert Janssens wrote: > Hi, > > I'm afraid this problem has been mentioned more than once on this list > before. I tried all suggestions for solutions I could find, but I can't > seem to fix this: > > I have a database in PostgreSQL version 8.0.8, and a frontend created in Ms > Access 2000, connecting to the database via psqlODBC version 8.01.02. > > This particular table was created as follows: > CREATE TABLE tvinvoice ( > invoiceid serial NOT NULL, > number character varying(50) NOT NULL, > date date, > vendorid integer NOT NULL, > "type" character varying(50) NOT NULL, > entrydate date DEFAULT ('now'::text)::date, > isempty boolean, > dt timestamp(0) without time zone NOT NULL > ); > ALTER TABLE ONLY tvinvoice > ADD CONSTRAINT tvinvoice_dt_key UNIQUE (dt); > ALTER TABLE ONLY tvinvoice > ADD CONSTRAINT tvinvoice_number_key UNIQUE (number); > ALTER TABLE ONLY tvinvoice > ADD CONSTRAINT tvinvoice_pkey PRIMARY KEY (invoiceid); > ALTER TABLE ONLY tvinvoice > ADD CONSTRAINT "$1" FOREIGN KEY (vendorid) REFERENCES tvendor(vendorid) > ON UPDATE CASCADE ON DELETE RESTRICT; > > Note: the dt timestamp field was added later in an effort to fix the > problem I'll describe just later on. > > In the Access database, I have a link to this table, and a form in to > manipulate it. > > Now I can add new records with no problem to this table via the form, but > if I try to update or delete existing records, I get the error: > > Write conflict: > This record has been changed by another user since you started > editing it. If you save the record, you will overwrite the changes > the other user made. > Copying the changes to the clipboard will let you look at the values > the other user entered, and then paste your changes back in if you > decide to make changes. > > I can't choose Save Record at this point, only copy to clipboard or drop > changes. > > * My first attempt was to add a timestamp field with a unique constraint. I > found this solution in some faq on the internet. For the records that were > already in this table, I used to_timestamp('invoiceid','J') to set an > initial (and unique) timestamp. ('J' is the Julian days since 4xxx BC, so > since each invoiceid is unique, the timestamp generated from it, should > also be). > > I relinked the table, added the timestamp to the form, and tried to update > a record again. The error kept coming back. > > * Next I found in the faq that is distributed with psqlODBC that the > seconds precision had changed, which could cause the same problem. So in > Postgres, I updated the field definition to timestamp(0) as per the faq. > > I relinked the table, added the timestamp to the form, and tried to update > a record again. The error kept coming back. > > * I also found a message stating that row versioning should be enabled in > the ODBC connection setting. I tried this as well with no luck. > > I also logged some of the queries that MS Access performs via the psql_comm > log. Here are the results: > > When opening form: > > conn=155994856, query='fetch 100 in SQL_CUR094664C0' > conn=147666896, query='declare SQL_CUR08CD6440 cursor for > SELECT > "invoiceid","number","date","vendorid","type","entrydate","isempty","dt" > FROM "public"."tvinvoice" WHERE "invoiceid" = 14 OR "invoiceid" = 15 OR > "invoiceid" = 16 OR "invoiceid" = 17 OR "invoiceid" = 18 OR "invoiceid" = > 19 OR "invoiceid" = 20 OR "invoiceid" = 21 OR "invoiceid" = 22 OR > "invoiceid" = 23' > conn=147666896, query='fetch 100 in SQL_CUR08CD6440' > conn=147666896, query='fetch 100 in SQL_CUR08CD6440' > conn=147666896, query='close SQL_CUR08CD6440' > conn=147666896, query='COMMIT' > ... > > When selecting last record: > > conn=147666896, query='declare SQL_CUR08CD6440 cursor for > SELECT > "invoiceid","number","date","vendorid","type","entrydate","isempty","dt" > FROM "public"."tvinvoice" WHERE "invoiceid" = 959 OR "invoiceid" = 959 OR > "invoiceid" = 959 OR "invoiceid" = 959 OR "invoiceid" = 959 OR "invoiceid" > = 959 OR "invoiceid" = 959 OR "invoiceid" = 959 OR "invoiceid" = 959 OR > "invoiceid" = 959' > conn=147666896, query='fetch 100 in SQL_CUR08CD6440' > conn=147666896, query='fetch 100 in SQL_CUR08CD6440' > conn=147666896, query='close SQL_CUR08CD6440' > conn=147666896, query='COMMIT' > conn=155994856, query='declare SQL_CUR094664C0 cursor for > SELECT "vendorid" ,"name" ,"code" ,"defaultcurrency" ,"lastref" ,"comments" > FROM "public"."tvendor" ' > conn=155994856, query='fetch 100 in SQL_CUR094664C0' > conn=155994856, query='fetch 100 in SQL_CUR094664C0' > conn=147666896, query='declare SQL_CUR08CD6440 cursor for > SELECT > "invoiceid","number","date","vendorid","type","entrydate","isempty","dt" > FROM "public"."tvinvoice" WHERE "invoiceid" = 857 OR "invoiceid" = 858 OR > "invoiceid" = 859 OR "invoiceid" = 860 OR "invoiceid" = 861 OR "invoiceid" > = 862 OR "invoiceid" = 863 OR "invoiceid" = 864 OR "invoiceid" = 865 OR > "invoiceid" = 866' > conn=147666896, query='fetch 100 in SQL_CUR08CD6440' > conn=147666896, query='fetch 100 in SQL_CUR08CD6440' > conn=147666896, query='close SQL_CUR08CD6440' > conn=147666896, query='COMMIT' > > When trying to update "date": > > conn=147666896, query='UPDATE "public"."tvinvoice" > SET "date"='2006-09-15'::date WHERE "invoiceid" = 959 AND "number" > = 'TS-test' AND "date" = '2006-09-05'::date AND "vendorid" = 185 AND "type" > = 'Detail' AND "entrydate" = '2006-09-05'::date AND "isempty" = '0' AND > "dt" = '4711-07-10 00:00:00'::timestamp' > conn=147666896, query='ROLLBACK' > > Obviously MS Access is not using dt as a unique field to identify the > records, but I can't find out why. > > I have no other ideas to try anymore. Does anybody else do ? I'll gladly > provide more details should the above not be sufficient. > > Regards, > > > Geert Janssens -- Kobalt W.I.T. Web & Information Technology Brusselsesteenweg 152 1850 Grimbergen Tel : +32 479 339 655 Email: info@kobaltwit.be