From: Timo Sirainen Date: Tue, 12 May 2009 23:34:54 +0000 (-0400) Subject: pgsql: We didn't read all the SQL packets replies from the server. X-Git-Tag: 2.0.alpha1~781 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=26cdaf7097427fa90343260fa236af12ab93cca3;p=thirdparty%2Fdovecot%2Fcore.git pgsql: We didn't read all the SQL packets replies from the server. --HG-- branch : HEAD --- diff --git a/src/lib-sql/driver-pgsql.c b/src/lib-sql/driver-pgsql.c index b00f988c9b..3ffa674881 100644 --- a/src/lib-sql/driver-pgsql.c +++ b/src/lib-sql/driver-pgsql.c @@ -696,7 +696,16 @@ static int driver_pgsql_result_next_row(struct sql_result *_result) if (result->rows != 0) { /* second time we're here */ - return ++result->rownum < result->rows; + if (++result->rownum < result->rows) + return 1; + + /* end of this packet. see if there's more. FIXME: this may + block, but the current API doesn't provide a non-blocking + way to do this.. */ + PQclear(result->pgres); + result->pgres = PQgetResult(db->pg); + if (result->pgres == NULL) + return 0; } if (result->pgres == NULL)