diff options
-rw-r--r-- | odb/mysql/statement.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx index 85732de..0badb17 100644 --- a/odb/mysql/statement.cxx +++ b/odb/mysql/statement.cxx @@ -623,7 +623,10 @@ namespace odb if (mysql_stmt_execute (stmt_)) { - if (mysql_stmt_errno (stmt_) == ER_DUP_ENTRY) + // An auto-assigned object id should never cause a duplicate + // primary key. + // + if (returning_ == 0 && mysql_stmt_errno (stmt_) == ER_DUP_ENTRY) return false; else translate_error (conn_, stmt_); |