Skip site navigation (1) Skip section navigation (2)

Re: @@IDENTITY (Was: Access - ODBC - serial problem)

From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: "Philippe Lang" <philippe(dot)lang(at)attiksystem(dot)ch>,<pgsql-odbc(at)postgresql(dot)org>
Cc: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Subject: Re: @@IDENTITY (Was: Access - ODBC - serial problem)
Date: 2004-04-10 20:28:19
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc

> -----Original Message-----
> From: Philippe Lang [mailto:philippe(dot)lang(at)attiksystem(dot)ch] 
> Sent: 10 April 2004 09:59
> To: pgsql-odbc(at)postgresql(dot)org
> Cc: scott.marlowe
> Subject: Re: [ODBC] @@IDENTITY (Was: Access - ODBC - serial problem)
> > For reasons unfathomable to modern man, Microsoft chose 
> @@IDENTITY to mean, not the current user, as I or you or any 
> sane person would expect, but to hold the incremented value of 
> an autoincrementing column fed by an insert.
> Another triumph in orthogonally named things from Microsoft.

Ahh, that was some good thinking on their part, though it does sorta
make sense. 
> - After an insert, Postgresql ODBC driver reads the data 
> based on the values that have been inserted. There are cases 
> were these values already existed in the table before the 
> insert, and so the autoincrement fetched may not be correct.

It does? I wasn't aware of that. I assume you mean when using cursors
(which I never use) as it doesn't following a regular insert statement.

> Is there anything that can be done at the driver level?

Standard answer: The best method would be to do a "SELECT
currval('seq_name');" when required on the relevant sequence. 

Regards, Dave.

pgsql-odbc by date

Next:From: Dave PageDate: 2004-04-10 21:21:08
Subject: Re: fixes for psqlodbc-07.03.200, patch
Previous:From: Bruce MomjianDate: 2004-04-10 19:40:55
Subject: Re: ODBC driver further developments?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group