pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitriy Ivanov <divanov-NOSP@M-aha.ru>
To: pgsql-odbc@postgresql.org
Subject: Re: Serial columns and ADO
Date: Fri, 17 Nov 2006 20:22:34 +0300
Message-ID: <ejkrei$14kk$1@news.hub.org> (raw)
References: <E1Gi7Ct-0004cO-00.sdld-mail-ru@f76.mail.ru>
	<4553CAC6.5020001@tpf.co.jp>
	<ej1ghi$1sa8$1@news.hub.org>
	<4554463D.6000301@tpf.co.jp>
	<ej1tlg$6km$1@news.hub.org>
	<45549258.9010802@tpf.co.jp>
	<4557B1C5.1030200@tpf.co.jp>
	<ej9djc$1imc$1@news.hub.org>
	<455C6F5F.7000203@tpf.co.jp>
	<ejjrgl$2bjg$1@news.hub.org>

Hello Dmitry,
"Dmitry Samokhin" <sdld@mail.ru> 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





view thread (11+ messages)

Message-ID: <ejkrei$14kk$1@news.hub.org>
Permalink:  ../ejkrei$14kk$1@news.hub.org/
Also on:    postgresql.org/message-id/ejkrei$14kk$1@news.hub.org

 · 

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: divanov-NOSP@M-aha.ru
  Subject: Re: Serial columns and ADO
  In-Reply-To: <ejkrei$14kk$1@news.hub.org>
  References: <E1Gi7Ct-0004cO-00.sdld-mail-ru@f76.mail.ru> <4553CAC6.5020001@tpf.co.jp> <ej1ghi$1sa8$1@news.hub.org> <4554463D.6000301@tpf.co.jp> <ej1tlg$6km$1@news.hub.org> <45549258.9010802@tpf.co.jp> <4557B1C5.1030200@tpf.co.jp> <ej9djc$1imc$1@news.hub.org> <455C6F5F.7000203@tpf.co.jp> <ejjrgl$2bjg$1@news.hub.org> <ejkrei$14kk$1@news.hub.org>

* 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