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

Commited11ccf

Browse files
committed
Fix comment-only query to return Null result set, rather than nothing.
Cleans up blank query handling to be more consistent.
1 parent23ecb88 commited11ccf

File tree

1 file changed

+20
-29
lines changed

1 file changed

+20
-29
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.318 2003/03/20 07:02:10 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.319 2003/03/22 04:23:34 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -927,6 +927,10 @@ pg_exec_query_string(StringInfo query_string,/* string to execute */
927927
EndCommand(commandTag,dest);
928928
}/* end loop over parsetrees */
929929

930+
/* No parsetree - return empty result */
931+
if (!parsetree_list)
932+
NullCommand(dest);
933+
930934
/*
931935
* Close down transaction statement, if one is open. (Note that this
932936
* will only happen if the querystring was empty.)
@@ -1789,7 +1793,7 @@ PostgresMain(int argc, char *argv[], const char *username)
17891793
if (!IsUnderPostmaster)
17901794
{
17911795
puts("\nPOSTGRES backend interactive interface ");
1792-
puts("$Revision: 1.318 $ $Date: 2003/03/20 07:02:10 $\n");
1796+
puts("$Revision: 1.319 $ $Date: 2003/03/22 04:23:34 $\n");
17931797
}
17941798

17951799
/*
@@ -1995,36 +1999,23 @@ PostgresMain(int argc, char *argv[], const char *username)
19951999
* 'Q' indicates a user query
19962000
*/
19972001
case'Q':
1998-
if (strspn(parser_input->data," \t\r\n")==parser_input->len)
1999-
{
2000-
/*
2001-
* if there is nothing in the input buffer, don't
2002-
* bother trying to parse and execute anything; just
2003-
* send back a quick NullCommand response.
2004-
*/
2005-
if (IsUnderPostmaster)
2006-
NullCommand(Remote);
2007-
}
2008-
else
2009-
{
2010-
/*
2011-
* otherwise, process the input string.
2012-
*
2013-
* Note: transaction command start/end is now done within
2014-
* pg_exec_query_string(), not here.
2015-
*/
2016-
if (log_statement_stats)
2017-
ResetUsage();
2002+
/*
2003+
* otherwise, process the input string.
2004+
*
2005+
* Note: transaction command start/end is now done within
2006+
* pg_exec_query_string(), not here.
2007+
*/
2008+
if (log_statement_stats)
2009+
ResetUsage();
20182010

2019-
pgstat_report_activity(parser_input->data);
2011+
pgstat_report_activity(parser_input->data);
20202012

2021-
pg_exec_query_string(parser_input,
2022-
whereToSendOutput,
2023-
QueryContext);
2013+
pg_exec_query_string(parser_input,
2014+
whereToSendOutput,
2015+
QueryContext);
20242016

2025-
if (log_statement_stats)
2026-
ShowUsage("QUERY STATISTICS");
2027-
}
2017+
if (log_statement_stats)
2018+
ShowUsage("QUERY STATISTICS");
20282019
break;
20292020

20302021
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp