Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd25ada4

Browse files
committed
Fix libpq so that it reports PGRES_EMPTY_QUERY not PGRES_COMMAND_OK when an
empty query string is passed to PQexecParams and related functions. Itshandling of the NoData response to Describe messages was subtly incorrect.Per my report of yesterday.Although I consider this a bug, it's a behavioral change that might affectapplications, so not back-patched.In passing fix a second issue in the same code: it didn't react well to anout-of-memory failure while trying to make the PGresult object.
1 parentd04db37 commitd25ada4

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

‎src/interfaces/libpq/fe-protocol3.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.37 2009/01/01 17:24:03momjian Exp $
11+
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.38 2009/01/09 18:50:03tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -297,19 +297,24 @@ pqParseInput3(PGconn *conn)
297297
/*
298298
* NoData indicates that we will not be seeing a
299299
* RowDescription message because the statement or portal
300-
* inquired about doesn't return rows. Set up a COMMAND_OK
301-
* result, instead of TUPLES_OK.
302-
*/
303-
if (conn->result==NULL)
304-
conn->result=PQmakeEmptyPGresult(conn,
305-
PGRES_COMMAND_OK);
306-
307-
/*
308-
* If we're doing a Describe, we're ready to pass the
309-
* result back to the client.
300+
* inquired about doesn't return rows.
301+
*
302+
* If we're doing a Describe, we have to pass something
303+
* back to the client, so set up a COMMAND_OK result,
304+
* instead of TUPLES_OK. Otherwise we can just ignore
305+
* this message.
310306
*/
311307
if (conn->queryclass==PGQUERY_DESCRIBE)
308+
{
309+
if (conn->result==NULL)
310+
{
311+
conn->result=PQmakeEmptyPGresult(conn,
312+
PGRES_COMMAND_OK);
313+
if (!conn->result)
314+
return;
315+
}
312316
conn->asyncStatus=PGASYNC_READY;
317+
}
313318
break;
314319
case't':/* Parameter Description */
315320
if (getParamDescriptions(conn))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp