Skip to content

Commit 4b4c43b

Browse files
committed
This patch fixes an obvious bug in the "should I print the duration of
this query?" logic in postgres.c Also, make it print "duration:" like log_duration. Neil Conway
1 parent fc7a2af commit 4b4c43b

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/backend/tcop/postgres.c

Lines changed: 8 additions & 16 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.367 2003/09/29 00:05:25 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.368 2003/09/29 18:50:58 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -955,25 +955,17 @@ exec_simple_query(const char *query_string)
955955
usecs = (long) (stop_t.tv_sec - start_t.tv_sec) * 1000000 + (long) (stop_t.tv_usec - start_t.tv_usec);
956956

957957
/*
958-
* Output a duration_query to the log if the query has exceeded
959-
* the min duration.
958+
* Output a duration_statement to the log if the query has exceeded
959+
* the min duration, or if we are to print all durations.
960960
*/
961-
if (usecs >= save_log_min_duration_statement * 1000)
961+
if (save_log_duration ||
962+
(save_log_min_duration_statement > 0 &&
963+
usecs >= save_log_min_duration_statement * 1000))
962964
ereport(LOG,
963-
(errmsg("duration_statement: %ld.%06ld %s",
965+
(errmsg("duration: %ld.%06ld %s",
964966
(long) (stop_t.tv_sec - start_t.tv_sec),
965967
(long) (stop_t.tv_usec - start_t.tv_usec),
966968
query_string)));
967-
968-
/*
969-
* If the user is requesting logging of all durations, then log
970-
* that as well.
971-
*/
972-
if (save_log_duration)
973-
ereport(LOG,
974-
(errmsg("duration: %ld.%06ld sec",
975-
(long) (stop_t.tv_sec - start_t.tv_sec),
976-
(long) (stop_t.tv_usec - start_t.tv_usec))));
977969
}
978970

979971
if (save_log_statement_stats)
@@ -2662,7 +2654,7 @@ PostgresMain(int argc, char *argv[], const char *username)
26622654
if (!IsUnderPostmaster)
26632655
{
26642656
puts("\nPOSTGRES backend interactive interface ");
2665-
puts("$Revision: 1.367 $ $Date: 2003/09/29 00:05:25 $\n");
2657+
puts("$Revision: 1.368 $ $Date: 2003/09/29 18:50:58 $\n");
26662658
}
26672659

26682660
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy