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

Commit1c4d4cb

Browse files
committed
Fix log_duration and log_min_duration_statement to print properly, as
pointed out by Peter.
1 parent7ca4485 commit1c4d4cb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 10 additions & 7 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.369 2003/10/02 06:34:04petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.370 2003/10/04 02:47:04momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -943,6 +943,7 @@ exec_simple_query(const char *query_string)
943943
if (save_log_duration||save_log_min_duration_statement>0)
944944
{
945945
longusecs;
946+
boolprint_statement;
946947

947948
gettimeofday(&stop_t,NULL);
948949
if (stop_t.tv_usec<start_t.tv_usec)
@@ -956,14 +957,16 @@ exec_simple_query(const char *query_string)
956957
* Output a duration_statement to the log if the query has exceeded
957958
* the min duration, or if we are to print all durations.
958959
*/
959-
if (save_log_duration||
960-
(save_log_min_duration_statement>0&&
961-
usecs >=save_log_min_duration_statement*1000))
960+
print_statement= (save_log_min_duration_statement>0&&
961+
usecs >=save_log_min_duration_statement*1000);
962+
963+
if (save_log_duration||print_statement)
962964
ereport(LOG,
963-
(errmsg("duration: %ld.%06ld%s",
965+
(errmsg("duration(secs): %ld.%06ld%s%s",
964966
(long) (stop_t.tv_sec-start_t.tv_sec),
965967
(long) (stop_t.tv_usec-start_t.tv_usec),
966-
query_string)));
968+
print_statement ?" " :"",
969+
print_statement ?query_string :"")));
967970
}
968971

969972
if (save_log_statement_stats)
@@ -2652,7 +2655,7 @@ PostgresMain(int argc, char *argv[], const char *username)
26522655
if (!IsUnderPostmaster)
26532656
{
26542657
puts("\nPOSTGRES backend interactive interface ");
2655-
puts("$Revision: 1.369 $ $Date: 2003/10/02 06:34:04 $\n");
2658+
puts("$Revision: 1.370 $ $Date: 2003/10/04 02:47:04 $\n");
26562659
}
26572660

26582661
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp