aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/sqlite/statement.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/odb/sqlite/statement.cxx b/odb/sqlite/statement.cxx
index 09188cb..5601047 100644
--- a/odb/sqlite/statement.cxx
+++ b/odb/sqlite/statement.cxx
@@ -675,9 +675,10 @@ namespace odb
// SQLITE_CONSTRAINT error code covers more than just a duplicate
// primary key. Unfortunately, there is nothing more precise that
// we can use (even sqlite3_errmsg() returns generic "constraint
- // failed").
+ // failed"). But an auto-assigned object id should never cause a
+ // duplicate primary key.
//
- if (e == SQLITE_CONSTRAINT)
+ if (returning_ == 0 && e == SQLITE_CONSTRAINT)
return false;
else
translate_error (e, conn_);