From: Eric Bollengier Date: Wed, 15 Jul 2009 14:02:47 +0000 (+0000) Subject: Fix #1335 about postgresql error message during copy session X-Git-Tag: Release-3.0.2~61 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=aab6213682ba5c134aa5eb229f4ce7fdcb93c29d;p=bacula%2Fbacula Fix #1335 about postgresql error message during copy session git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@9005 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/cats/postgresql.c b/bacula/src/cats/postgresql.c index d5b9879392..5c7b13d033 100644 --- a/bacula/src/cats/postgresql.c +++ b/bacula/src/cats/postgresql.c @@ -710,6 +710,7 @@ int my_postgresql_batch_end(JCR *jcr, B_DB *mdb, const char *error) { int res; int count=30; + PGresult *result; Dmsg0(500, "my_postgresql_batch_end started\n"); if (!mdb) { /* no files ? */ @@ -730,7 +731,15 @@ int my_postgresql_batch_end(JCR *jcr, B_DB *mdb, const char *error) mdb->status = 0; Mmsg1(&mdb->errmsg, _("error ending batch mode: %s"), PQerrorMessage(mdb->db)); } - + + /* Check command status and return to normal libpq state */ + result = PQgetResult(mdb->db); + if (PQresultStatus(result) != PGRES_COMMAND_OK) { + Mmsg1(&mdb->errmsg, _("error ending batch mode: %s"), PQerrorMessage(mdb->db)); + mdb->status = 0; + } + PQclear(result); + Dmsg0(500, "my_postgresql_batch_end finishing\n"); return mdb->status; @@ -775,7 +784,7 @@ int my_postgresql_batch_insert(JCR *jcr, B_DB *mdb, ATTR_DBR *ar) if (res <= 0) { Dmsg0(500, "we failed\n"); mdb->status = 0; - Mmsg1(&mdb->errmsg, _("error ending batch mode: %s"), PQerrorMessage(mdb->db)); + Mmsg1(&mdb->errmsg, _("error copying in batch mode: %s"), PQerrorMessage(mdb->db)); } Dmsg0(500, "my_postgresql_batch_insert finishing\n"); diff --git a/bacula/technotes b/bacula/technotes index 7e67774c65..d53fcd53cf 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -5,6 +5,7 @@ General: 15Jul09 kes Fix Win64 build kes Add more example SD Device configurations. +ebl Fix #1335 about postgresql error message during copy session ebl Cleanup old job records when starting the director (Created/Running -> Failed) ebl Force the client_encoding to SQL_ASCII when database is already