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

From: "Philippe Lang" <philippe(dot)lang(at)attiksystem(dot)ch>
To: <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 08:59:02
Message-ID: 6C0CF58A187DA5479245E0830AF84F420AFF27@poweredge.attiksystem.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

> 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.
>
> Anyway, what the original conversation was about was getting back the
auto
> increment value from pgsql via ODBC with access on top. The problem
being
> that postgresql doesn't have a simple "what was the autoincrement I
just put
> in" but requires the user to either use the system catalogs to look up
the
> sequence name and then use currval on it, or something like a plpgsql
function
> to insert your data.

-----------

Without a way of getting the autoincrement from the ODBC driver, there
will always be cases, when adding data to a table through a linked
table, where the data that appears onscreen is not the one that has been
added to the table. And this until you requery the whole table.

- After an insert, Microsft ODBC driver issues a "SELECT @@IDENTITY".

- 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.

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

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Ed Brown 2004-04-10 14:17:55 Re: @@IDENTITY (Was: Access - ODBC - serial problem)
Previous Message Sheeraz fazal 2004-04-09 21:40:14 Syntax to pass IN parameters through ODBC