From d28d7cabb0896a93edf33123b1e83f4af632e5e5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 25 Nov 2014 07:02:55 +0200 Subject: Don't try to translate duplicate primary key for auto-assigned id An auto-assigned object id should never cause a duplicate primary key. --- odb/pgsql/statement.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'odb/pgsql/statement.cxx') 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)); -- cgit v1.1