aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/pgsql/statement.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/odb/pgsql/statement.cxx b/odb/pgsql/statement.cxx
index bd27243..c5e9662 100644
--- a/odb/pgsql/statement.cxx
+++ b/odb/pgsql/statement.cxx
@@ -756,7 +756,10 @@ namespace odb
if (!is_good_result (h, &stat))
{
- if (PGRES_FATAL_ERROR == stat)
+ // An auto-assigned object id should never cause a duplicate
+ // primary key.
+ //
+ if (returning_ == 0 && stat == PGRES_FATAL_ERROR)
{
string s (PQresultErrorField (h, PG_DIAG_SQLSTATE));