[odb-users] lastval as primary key of the newly inserted entity
returns wrong value
Konstantin Mikhailov
ekimka at gmail.com
Fri Oct 28 00:58:39 EDT 2011
It looks like the odb trying to use lastval posgresql function call
(odb\pgsql\statement.cxx, l. 485) to obtain the primary key value
of the newly inserted entity when using id with auto pragma.
In case of any triggers involved into entity insertion (for example audit
triggers which can insert an audit record in different table(s)) and
accessing another (or even the same sequence used to generate
primary key) the odb behaviour can lead to very big problem. It
returns and assign to the persistent object wrong id.
The only workaround in the current version (1.6.0) - do not use the
auto pragma with id column if you have the triggers.
More information about the odb-users
mailing list