[odb-users] Get real error reason from object_already_persistent

Tomilov.Mikhail Mikhail.Tomilov at infotecs.ru
Fri Aug 8 04:58:21 EDT 2014


Hello!

We use postgresql with ODB.

Lets consider the following problem.
I need to insert a row into users table, which has unique constraint on 
"login" field and some FK. If I insert row with duplicate login field I 
get object_already_persistent exception. AFAIK object_already_persistent 
exception is thrown when any postgresql constraint fails. It could be PK 
constraint, unique constraint, FK constraint. Can I determine real 
reason for my case to pass correct error code to client?

It would be natural to get database error info from 
odb::object_already_persistent exception.

Thanks



More information about the odb-users mailing list