aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-11-25 07:02:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-25 07:02:55 +0200
commitd28d7cabb0896a93edf33123b1e83f4af632e5e5 (patch)
tree4bb3ba3dfcd0157bbeffce70c9f9d14686db4f00
parent2db43d4c2f2bed0348d781367090e633ad02779f (diff)
Don't try to translate duplicate primary key for auto-assigned id
An auto-assigned object id should never cause a duplicate primary key.
-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));