Received: from localhost (uranus.hub.org [200.46.204.60]) by postgresql.org (Postfix) with ESMTP id 4A69C9F9EC9 for ; Fri, 17 Nov 2006 13:51:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.60]) (amavisd-new, port 10024) with ESMTP id 05409-07 for ; Fri, 17 Nov 2006 13:51:37 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by postgresql.org (Postfix) with ESMTP id C1FA59F9B3F for ; Fri, 17 Nov 2006 13:51:36 -0400 (AST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.13.1/8.13.1) with ESMTP id kAHHpU7q057848 for ; Fri, 17 Nov 2006 13:51:30 -0400 (AST) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.13.1/8.13.1/Submit) id kAHHRl1k037542 for pgsql-odbc@postgresql.org; Fri, 17 Nov 2006 13:27:47 -0400 (AST) (envelope-from news) From: "Dmitriy Ivanov" X-Newsgroups: pgsql.interfaces.odbc Subject: Re: Serial columns and ADO Date: Fri, 17 Nov 2006 20:22:34 +0300 Organization: Ystok-Systema Lines: 32 Message-ID: References: <4553CAC6.5020001@tpf.co.jp> <4554463D.6000301@tpf.co.jp> <45549258.9010802@tpf.co.jp> <4557B1C5.1030200@tpf.co.jp> <455C6F5F.7000203@tpf.co.jp> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Comment-To: Dmitry Samokhin To: pgsql-odbc@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/54 X-Sequence-Number: 8436 Hello Dmitry, "Dmitry Samokhin" wrote: DS> But there's still another problem. Let our table 't1' be initially DS> empty and the sequence reset to 1. Consider the following ADO operations: DS> DS> rs.AddNew DS> rs("col2") = "Sample string" DS> rs.Update DS> MsgBox rs("col1") DS> DS> rs.AddNew DS> rs("col1") = 2 DS> rs("col2") = "Sample string" DS> rs.Update DS> MsgBox rs("col1") DS> DS> Look, the second insert operation sets the identity field DS> explicitly. But the driver still lets 'SELECT currval...' to pass. DS> As a result, my explicit value '2' is replaced by the currval()=1. DS> Such distortion should be avoided anyway. Generally, if you declared the column type as serial, you should not set it explicitly while inserting records. In your example, rs.Update does not guarantee changing the cursor position to the record inserted most recently. (At least, with DAO against MS Access database.) IMHO, it is not the ODBC driver to blame. -- Sincerely, Dmitriy Ivanov