Commit a9ed49d5 authored by Marc G. Fournier's avatar Marc G. Fournier

From: Oliver Elphick <olly@lfix.co.uk>

If PQfn() receives NOTICEs from the backend, it fails because there is no
provision to deal with them.

This patch (supplied by Anders Hammarquist <iko@netg.se> to me as Debian
maintainer of postgresql) cures the problem:
parent 23c04710
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.48 1998/03/15 08:11:11 scrappy Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.49 1998/04/29 02:04:01 scrappy Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1545,13 +1545,27 @@ PQfn(PGconn *conn, ...@@ -1545,13 +1545,27 @@ PQfn(PGconn *conn,
} }
pqFlush(pfout, pfdebug); pqFlush(pfout, pfdebug);
id = pqGetc(pfin, pfdebug); while ((id = pqGetc(pfin, pfdebug)) != 'V')
if (id != 'V')
{ {
if (id == 'E') if (id == 'E')
{ {
pqGets(conn->errorMessage, ERROR_MSG_LENGTH, pfin, pfdebug); pqGets(conn->errorMessage, ERROR_MSG_LENGTH, pfin, pfdebug);
} }
else if (id == 'N')
{
/* print notice and go back to processing return
values */
if (pqGets(conn->errorMessage, ERROR_MSG_LENGTH,
pfin, pfdebug) == 1)
{
sprintf(conn->errorMessage,
"Notice return detected from backend, but "
"message cannot be read");
}
else
fprintf(stderr, "%s\n", conn->errorMessage);
continue;
}
else else
sprintf(conn->errorMessage, sprintf(conn->errorMessage,
"PQfn: expected a 'V' from the backend. Got '%c' instead", "PQfn: expected a 'V' from the backend. Got '%c' instead",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment