X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id CF60BD1C9BE for ; Thu, 8 Apr 2004 13:44:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 09537-08 for ; Thu, 8 Apr 2004 13:44:54 -0300 (ADT) Received: from smtp1.actcom.co.il (smtp.actcom.co.il [192.114.47.13]) by svr1.postgresql.org (Postfix) with ESMTP id 5E8BBD1D105 for ; Thu, 8 Apr 2004 13:44:51 -0300 (ADT) Received: from actcom.co.il (actcom.co.il [192.114.47.1]) by smtp1.actcom.co.il (8.12.11/8.12.11) with ESMTP id i38Gif5W026141; Thu, 8 Apr 2004 19:44:41 +0300 Received: from shemesh.biz by actcom.co.il with ESMTP (8.11.6/actcom-0.3) id i38Gid725003; Thu, 8 Apr 2004 19:44:40 +0300 (EET DST) (rfc931-sender: line102-130.adsl.actcom.co.il [192.117.102.130]) Message-ID: <4075817D.1080106@shemesh.biz> Date: Thu, 08 Apr 2004 19:44:45 +0300 From: Shachar Shemesh Organization: Lingnu OpenSource Consulting User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040401 Debian/1.6-4 X-Accept-Language: en, he MIME-Version: 1.0 To: Philippe Lang Cc: pgsql-odbc@postgresql.org Subject: Re: Access - ODBC - serial problem... References: <6C0CF58A187DA5479245E0830AF84F420802A0@poweredge.attiksystem.ch> In-Reply-To: <6C0CF58A187DA5479245E0830AF84F420802A0@poweredge.attiksystem.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/64 X-Sequence-Number: 3959 Philippe Lang wrote: >Hello, > >I have made some more tests regarding my precedent post "[ODBC] Access - ODBC - index strange bug", and in fact it is not index-related. The bug is just more visible when an index is used, apparently. > >The problem comes from the serial identifier, which is not know from the client at the time the record is being inserted. > >With the table described below, imagine I do, from the client: > >insert into test (code) VALUES (20); > >How does the client know the id that has been given to the record? With ethereal, I could see Access fetches the id by doing a > >select id from test where code = 20" > >Of course, another record has the same code, and the wrong id is being fetched back. This explains what I have noticed, and that is explained below... > >Is there a solution to that, except inserting records with PL-PGSQL, which I already do in some cases, by the way...? > > I would love it if one of the resident Postgres gurus could verify this, but I think running "select currval('test_id_seq')" ought to do exactly what you want in this case. It should tell you the most recent id assigned by the sequence in your session. Can someone please verify that this command does not suffer races? Shachar -- Shachar Shemesh Lingnu OpenSource Consulting http://www.lingnu.com/