X-Original-To: pgsql-odbc@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 78C33475957 for ; Thu, 13 Feb 2003 16:05:35 -0500 (EST) Received: from iserver.abag.ca.gov (iserver.abag.ca.gov [198.31.87.3]) by postgresql.org (Postfix) with ESMTP id A9667474E5C for ; Thu, 13 Feb 2003 16:05:32 -0500 (EST) Received: from groupwise.abag.ca.gov (groupwise.abag.ca.gov [198.31.87.26]) by iserver.abag.ca.gov (8.12.4/8.12.4) with SMTP id h1DL5Xo3011656 for ; Thu, 13 Feb 2003 13:05:33 -0800 (PST) Received: from D01-Message_Server by groupwise.abag.ca.gov with Novell_GroupWise; Thu, 13 Feb 2003 13:05:33 -0800 Message-Id: X-Mailer: Novell GroupWise Internet Agent 5.5.6.1 Date: Thu, 13 Feb 2003 13:04:55 -0800 From: "Fred Parkinson" To: , Subject: Re: record locks? Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=_9FC0E08D.553455A8" X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/63 X-Sequence-Number: 2681 This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=_9FC0E08D.553455A8 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Thanks for responding, clearly i should have been more specific in my descr= iption of the problem. The linked table is a table, created in postgres with the CREATE TABLE comm= and. I am trying to update boolean fields through check boxs in Access datesheet= view, and also through bound controls on forms. I can insert a record through the Access datasheet view by typing a value i= nto the key field in the '*' record (the 'add new record' record) After that I can successfully update fields only if i do so before i leave = that record. After that, any other changes I try to make to the data, for example check = a check box to update a boolean field, i get the "the record has been changed by another u= ser..." message and changes are dropped. I can make updates to the table subsequently only if i execute sql commands= with the Access execute function. Since that form of update works, executing a sql query in access, the syste= m is correctly locating records by the key field value. When I ran the odbc driver install i unchecked the 'bool as char' box. I am actually doing no explicit record locking,=20 No one else is locking the record because we are testing a new system in a = very small development community (2 developers) and the other person is not= here! When our postgres/unix administrator returns i will ask him to turn on psq= lodbc logging to see what postgres thinks of attempts to update the fields = through bound Access controls and the Access datasheet view. Thanks for your help with this matter! Fred Parkinson >>> "Tambet Matiisen" 02/07/03 01:11AM >>> Is your linked table actually a view with insert/update/delete rules? Then the update through bound controls will not work in 7.2. 7.3 resolves the issue. Otherwise the problem could be float (or other non-exact) columns in your table. Access remembers old values of record and when updating, it adds them to where condition: UPDATE table SET col1 =3D newvalue WHERE id =3D old_id AND col1 =3D oldvalu= e1 AND col2 =3D oldvalue2; The mentioned error is returned when the update returns 0 modified rows - someone has changed the record and old values are not current any more. This is called optimistic locking. The problem is, that when Access remembers float values, it sometimes rounds them a bit. select 1/3::float, 0.333333333333333, 1/3::float =3D 0.333333333333333; ?column? | ?column? | ?column? -------------------+-------------------+---------- 0.333333333333333 | 0.333333333333333 | f (1 row) So the optimistic locking condition is not true any more, although the record has not changed. You have to switch on psqlodbc logging and see, what query Access executes. Then you have determine, what column is causing the error. Then you could change datatype of the column. Or you could build a view which rounds the value, add insert/update/delete rules to the view and do all database manipulation through view. I have seen this problem before in this list, so maybe someone has better solution. Tambet ----- Original Message ----- From: Fred Parkinson To: pgsql-odbc@postgresql.org Sent: Thursday, February 06, 2003 10:09 PM Subject: [ODBC] record locks? Whenever I edit a postgresql record from a MS Access datasheet view or bound control, it seems to lock the record forever and subsrquent edits result in "The record has been changed by another user blah blah ..." and I can no longer edit that record from the datasheet view or bound control (though I can execute a SQL query to update it). We are using postgresql 7.2 and ODBC driver 7.02.00.01 This persists even if I delete the linked table and relink it, or close and restart Access. Any ideas? Fred Parkinson ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster --=_9FC0E08D.553455A8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Description: HTML
Thanks for responding, clearly i should have been more= =20 specific in my description of the problem.
 
The linked table is a table, created in postgres with t= he=20 CREATE TABLE command.
I am trying to update boolean fields through check boxs= in=20 Access datesheet view, and also through bound controls on forms.
 
I can insert a record through the Access datasheet= view=20 by typing a value into the key field in the '*' record
(the 'add new record' record)
After that I can successfully update fields only if i d= o so=20 before i leave that record.
After that, any other changes I try to make to the data= , for=20 example check a check box to
update a boolean field, i get the "the record has been = changed=20 by another user..." message and changes are dropped.
I can make updates to the table subsequently only if i = execute=20 sql commands with the Access execute function.
Since that form of update works, executing a sql query = in=20 access, the system is correctly locating records by the key field=20 value.
 
When I ran the odbc driver install i unchecked the 'boo= l as=20 char' box.
 
I am actually doing no explicit record locking,
 
No one else is locking the record because we are testing a new system = in a=20 very small development community (2 developers) and the other person is not= =20 here!
 
When our postgres/unix administrator returns  i will ask him to t= urn=20 on psqlodbc logging to see what postgres thinks of attempts to update the f= ields=20 through bound Access controls and the Access datasheet view.
 
Thanks for your help with this matter!
 
Fred Parkinson

>>> "Tambet Matiisen"=20 <t.matiisen@aprote.ee> 02/07/03 01:11AM >>>
Is your linke= d=20 table actually a view with insert/update/delete rules? Then
the update= =20 through bound controls will not work in 7.2. 7.3 resolves=20 the
issue.

Otherwise the problem could be float (or other non-exa= ct)=20 columns in your
table. Access remembers old values of record and when=20 updating, it adds them
to where condition:

UPDATE table SET col1 = =3D=20 newvalue WHERE id =3D old_id AND col1 =3D oldvalue1 AND
col2 =3D=20 oldvalue2;

The mentioned error is returned when the update returns 0= =20 modified rows -
someone has changed the record and old values are not cu= rrent=20 any more. This
is called optimistic locking.

The problem is, that= when=20 Access remembers float values, it sometimes rounds
them a bit.

se= lect=20 1/3::float, 0.333333333333333, 1/3::float =3D=20 0.333333333333333;

    =20 ?column?      |    =20 ?column?      |=20 ?column?
-------------------+-------------------+----------
0.3333333= 33333333=20 | 0.333333333333333 | f
(1 row)

So the optimistic locking conditi= on is=20 not true any more, although the
record has not changed.

You have = to=20 switch on psqlodbc logging and see, what query Access executes.
Then you= have=20 determine, what column is causing the error. Then you could
change datat= ype=20 of the column. Or you could build a view which rounds the
value, add=20 insert/update/delete rules to the view and do all database
manipulation= =20 through view. I have seen this problem before in this list, so
maybe som= eone=20 has better solution.

  Tambet

----- Original Message=20 -----
From: Fred Parkinson
To: pgsql-odbc@postgresql.org
Sent:=20 Thursday, February 06, 2003 10:09 PM
Subject: [ODBC] record=20 locks?


Whenever I edit a postgresql  record from a MS Acces= s=20 datasheet view or
bound control, it seems to lock the record forever and= =20 subsrquent edits
result in "The record has been changed by another user = blah=20 blah ..." and I
can no longer edit that record from the datasheet view o= r=20 bound control
(though I can execute a SQL query to update it).

We= are=20 using postgresql 7.2 and ODBC driver 7.02.00.01

This persists even i= f I=20 delete the linked table and relink it, or close and
restart=20 Access.

Any ideas?

Fred=20 Parkinson


---------------------------(end of=20 broadcast)---------------------------
TIP 4: Don't 'kill -9' the=20 postmaster
--=_9FC0E08D.553455A8--