Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a9ed49d

Browse files
committed
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:
1 parent 23c0471 commit a9ed49d

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/interfaces/libpq/fe-exec.c

+17-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.48 1998/03/15 08:11:11 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.49 1998/04/29 02:04:01 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1545,13 +1545,27 @@ PQfn(PGconn *conn,
15451545
}
15461546
pqFlush(pfout, pfdebug);
15471547

1548-
id = pqGetc(pfin, pfdebug);
1549-
if (id != 'V')
1548+
while ((id = pqGetc(pfin, pfdebug)) != 'V')
15501549
{
15511550
if (id == 'E')
15521551
{
15531552
pqGets(conn->errorMessage, ERROR_MSG_LENGTH, pfin, pfdebug);
15541553
}
1554+
else if (id == 'N')
1555+
{
1556+
/* print notice and go back to processing return
1557+
values */
1558+
if (pqGets(conn->errorMessage, ERROR_MSG_LENGTH,
1559+
pfin, pfdebug) == 1)
1560+
{
1561+
sprintf(conn->errorMessage,
1562+
"Notice return detected from backend, but "
1563+
"message cannot be read");
1564+
}
1565+
else
1566+
fprintf(stderr, "%s\n", conn->errorMessage);
1567+
continue;
1568+
}
15551569
else
15561570
sprintf(conn->errorMessage,
15571571
"PQfn: expected a 'V' from the backend. Got '%c' instead",

0 commit comments

Comments
 (0)