From: | Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp> |
---|---|
To: | Dmitry Samokhin <sdld(at)mail(dot)ru> |
Cc: | pgsql-odbc(at)postgresql(dot)org |
Subject: | Re: Replacing IDENTITY with lastval() |
Date: | 2007-05-05 15:56:40 |
Message-ID: | 463CA938.6020206@tpf.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Dmitry Samokhin wrote:
> Accordind to the release notes, "Use lastval() function to replace IDENTITY on 8.1 or later servers" was introduced in release 8.2.0205. This may cause incorrect results: "<...> assumes that your database does not expect any triggers to fire when the INSERT is executed. If a trigger does fire and if that trigger adds another row to a table, the @@IDENTITY global variable would be set to point to that new Identity value—not the one your INSERT generated. <...> work for simple situations, but not when your database gets more sophisticated".
> See "Managing an @@IDENTITY Crisis" on MSDN (http://msdn2.microsoft.com/en-us/library/ms971502.aspx) for more details.
>
> The PostgreSQL documentation states that the lastval() function returns the value most recently returned by nextval in the current session. It works the same way as the @@IDENTITY variable in MSSQL. The currval(...) function returns a value of the explicitly specified sequence, this is exactly what we need.
>
> Please consider to revert the code.
OK I would take care of it in 8.2.0402.
regards,
Hiroshi Inoue
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas | 2007-05-05 16:47:28 | Re: Replacing IDENTITY with lastval() |
Previous Message | noreply | 2007-05-04 22:01:38 | [ psqlodbc-Bugs-1003103 ] copy_and_convert_field(...) destroys bind info for wide char varchar columns |