aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-exec.c
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1998-04-29 02:04:01 +0000
committerMarc G. Fournier <scrappy@hub.org>1998-04-29 02:04:01 +0000
commita9ed49d5b5661626280fca3f45c3d8ae3f9b69e4 (patch)
treefd553efbe8a33a26742c415d17a0f729d24f788e /src/interfaces/libpq/fe-exec.c
parent23c0471007d9ceb9ea247a902ca3d4e5d1561f43 (diff)
downloadpostgresql-a9ed49d5b5661626280fca3f45c3d8ae3f9b69e4.tar.gz
postgresql-a9ed49d5b5661626280fca3f45c3d8ae3f9b69e4.zip
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:
Diffstat (limited to 'src/interfaces/libpq/fe-exec.c')
-rw-r--r--src/interfaces/libpq/fe-exec.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index c82d8381061..4297abcfd99 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -7,7 +7,7 @@
*
*
* 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,
}
pqFlush(pfout, pfdebug);
- id = pqGetc(pfin, pfdebug);
- if (id != 'V')
+ while ((id = pqGetc(pfin, pfdebug)) != 'V')
{
if (id == 'E')
{
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
sprintf(conn->errorMessage,
"PQfn: expected a 'V' from the backend. Got '%c' instead",