From: Jeff Eckermann <jeff_eckermann@yahoo.com>
To: Philippe Lang <philippe.lang@attiksystem.ch>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Dealing with Insert Problems with Access
Date: Wed, 21 Apr 2004 13:22:41 -0700 (PDT)
Message-ID: <20040421202241.57574.qmail@web20809.mail.yahoo.com> (raw)
In-Reply-To: <6C0CF58A187DA5479245E0830AF84F420802BA@poweredge.attiksystem.ch>
--- Philippe Lang <philippe.lang@attiksystem.ch>
wrote:
>
> Between the moment you have fetched the next id, and
> the moment Access
> does the insert into the table, another user or
> process could so the
> same thing, and fetch the exact same next id, which
> would result in an
> insert conflict, no? If I'm not wrong, in order to
No. The "nextval" function returns the next available
sequence number, and advances the sequence at the same
time. So a subsequent call will never get the same
number.
> have something fully
> multiuser-safe, you should use a stored procedure,
> and even switch to a
> serializable isolation level. I personally use LOCK
> TABLE. Then, with
With MVCC, it is almost never necessary to lock a
table (I've never needed to).
> the id your stored procedure gives you back, you
> open the record from
> Access.
>
> The problem, with that solution, is that it requires
> a stored procedure
> call prior to typing any data. It does not solve the
> problem we may
> encounter with a raw linked table or subform in
> Access, when the data
> being inserted is already present in another row of
> the table. In that
> case, as mentioned in posts last week, the id
> fetched back may be wrong!
> That's really dangerous...
>
> That's why I like your second solution: there must
> be a way of forcing
> Access to generate client-side a timestamp (with
> miliseconds) or some
> sort of unique random number, before each insert. In
> that case, the id
> fetched back by Access is 99.999999% the one you
> expect. If I'm not
> wrong, this kind of "trick" is even advised with an
> SQL Server backend,
> too...
Yes, I am sure this solution would work fine. Which
is why I had to think a bit before choosing.
>
>
> Philippe Lang
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25ยข
http://photos.yahoo.com/ph/print_splash
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: jeff_eckermann@yahoo.com, philippe.lang@attiksystem.ch
Subject: Re: Dealing with Insert Problems with Access
In-Reply-To: <20040421202241.57574.qmail@web20809.mail.yahoo.com>
References: <6C0CF58A187DA5479245E0830AF84F420802BA@poweredge.attiksystem.ch> <20040421202241.57574.qmail@web20809.mail.yahoo.com>
* 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