8000 Cope with NoData message from backend. Needed for case where · codeimmortal/postgres@90ade5b · GitHub
[go: up one dir, main page]

Skip to content

Commit 90ade5b

Browse files
committed
Cope with NoData message from backend. Needed for case where
PQexecParams is used with a statement that doesn't return data.
1 parent b6e5823 commit 90ade5b

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/interfaces/libpq/fe-protocol3.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.6 2003/08/04 02:40:20 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.7 2003/08/12 21:34:44 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -232,8 +232,7 @@ pqParseInput3(PGconn *conn)
232232
if (pqGetInt(&(conn->be_key), 4, conn))
233233
return;
234234
break;
235-
case 'T': /* row descriptions (start of query
236-
* results) */
235+
case 'T': /* Row Description */
237236
if (conn->result == NULL)
238237
{
239238
/* First 'T' in a query sequence */
@@ -253,6 +252,17 @@ pqParseInput3(PGconn *conn)
253252
return;
254253
}
255254
break;
255+
case 'n': /* No Data */
256+
/*
257+
* NoData indicates that we will not be seeing a
258+
* RowDescription message because the statement or
259+
* portal inquired about doesn't return rows.
260+
* Set up a COMMAND_OK result, instead of TUPLES_OK.
261+
*/
262+
if (conn->result == NULL)
263+
conn->result = PQmakeEmptyPGresult(conn,
264+
PGRES_COMMAND_OK);
265+
break;
256266
case 'D': /* Data Row */
257267
if (conn->result != NULL &&
258268
conn->result->resultStatus == PGRES_TUPLES_OK)

0 commit comments

Comments
 (0)
0