mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Fix comment-only query to return Null result set, rather than nothing.
Cleans up blank query handling to be more consistent.
This commit is contained in:
parent
23ecb8855d
commit
ed11ccf4d4
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.318 2003/03/20 07:02:10 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.319 2003/03/22 04:23:34 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -927,6 +927,10 @@ pg_exec_query_string(StringInfo query_string, /* string to execute */
|
|||||||
EndCommand(commandTag, dest);
|
EndCommand(commandTag, dest);
|
||||||
} /* end loop over parsetrees */
|
} /* end loop over parsetrees */
|
||||||
|
|
||||||
|
/* No parsetree - return empty result */
|
||||||
|
if (!parsetree_list)
|
||||||
|
NullCommand(dest);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Close down transaction statement, if one is open. (Note that this
|
* Close down transaction statement, if one is open. (Note that this
|
||||||
* will only happen if the querystring was empty.)
|
* will only happen if the querystring was empty.)
|
||||||
@ -1789,7 +1793,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
|||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
puts("\nPOSTGRES backend interactive interface ");
|
puts("\nPOSTGRES backend interactive interface ");
|
||||||
puts("$Revision: 1.318 $ $Date: 2003/03/20 07:02:10 $\n");
|
puts("$Revision: 1.319 $ $Date: 2003/03/22 04:23:34 $\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1995,36 +1999,23 @@ PostgresMain(int argc, char *argv[], const char *username)
|
|||||||
* 'Q' indicates a user query
|
* 'Q' indicates a user query
|
||||||
*/
|
*/
|
||||||
case 'Q':
|
case 'Q':
|
||||||
if (strspn(parser_input->data, " \t\r\n") == parser_input->len)
|
/*
|
||||||
{
|
* otherwise, process the input string.
|
||||||
/*
|
*
|
||||||
* if there is nothing in the input buffer, don't
|
* Note: transaction command start/end is now done within
|
||||||
* bother trying to parse and execute anything; just
|
* pg_exec_query_string(), not here.
|
||||||
* send back a quick NullCommand response.
|
*/
|
||||||
*/
|
if (log_statement_stats)
|
||||||
if (IsUnderPostmaster)
|
ResetUsage();
|
||||||
NullCommand(Remote);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* otherwise, process the input string.
|
|
||||||
*
|
|
||||||
* Note: transaction command start/end is now done within
|
|
||||||
* pg_exec_query_string(), not here.
|
|
||||||
*/
|
|
||||||
if (log_statement_stats)
|
|
||||||
ResetUsage();
|
|
||||||
|
|
||||||
pgstat_report_activity(parser_input->data);
|
pgstat_report_activity(parser_input->data);
|
||||||
|
|
||||||
pg_exec_query_string(parser_input,
|
pg_exec_query_string(parser_input,
|
||||||
whereToSendOutput,
|
whereToSendOutput,
|
||||||
QueryContext);
|
QueryContext);
|
||||||
|
|
||||||
if (log_statement_stats)
|
if (log_statement_stats)
|
||||||
ShowUsage("QUERY STATISTICS");
|
ShowUsage("QUERY STATISTICS");
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user