michael.vancann...@wisa.be wrote:

Before MySQL 5.0.12 last_insert_id returns table 2, since 5.0.12 table 1.
Triggers were introduced in 5.0.2.

SQLServer's SCOPE_IDENTITY() returns table 1 (the trigger is out of scope)
and @@IDENTITY returns 2.

This mess is why I prefer sequences :-)

:-) I had to tackle this one with PostgreSQL about ten years ago. I don't know whether sequences weren't implemented at the time or if I was simply too unfamiliar with the system to get things working, but I ended up generating a random primary key in the (Delphi) program that was committing the data and relying on the server to reject it if not unique.

A minor warning about Postgres's serial type: if the table is cleared the underlying sequence isn't automatically reset. That might or might not be what's needed/expected.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to