Fix log_duration and log_min_duration_statement to print properly, as
pointed out by Peter.
This commit is contained in:
parent
7ca44855fc
commit
1c4d4cb17d
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.369 2003/10/02 06:34:04 petere Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.370 2003/10/04 02:47:04 momjian Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -943,6 +943,7 @@ exec_simple_query(const char *query_string)
|
|||||||
if (save_log_duration || save_log_min_duration_statement > 0)
|
if (save_log_duration || save_log_min_duration_statement > 0)
|
||||||
{
|
{
|
||||||
long usecs;
|
long usecs;
|
||||||
|
bool print_statement;
|
||||||
|
|
||||||
gettimeofday(&stop_t, NULL);
|
gettimeofday(&stop_t, NULL);
|
||||||
if (stop_t.tv_usec < start_t.tv_usec)
|
if (stop_t.tv_usec < start_t.tv_usec)
|
||||||
@ -956,14 +957,16 @@ exec_simple_query(const char *query_string)
|
|||||||
* Output a duration_statement to the log if the query has exceeded
|
* Output a duration_statement to the log if the query has exceeded
|
||||||
* the min duration, or if we are to print all durations.
|
* the min duration, or if we are to print all durations.
|
||||||
*/
|
*/
|
||||||
if (save_log_duration ||
|
print_statement = (save_log_min_duration_statement > 0 &&
|
||||||
(save_log_min_duration_statement > 0 &&
|
usecs >= save_log_min_duration_statement * 1000);
|
||||||
usecs >= save_log_min_duration_statement * 1000))
|
|
||||||
|
if (save_log_duration || print_statement)
|
||||||
ereport(LOG,
|
ereport(LOG,
|
||||||
(errmsg("duration: %ld.%06ld %s",
|
(errmsg("duration(secs): %ld.%06ld%s%s",
|
||||||
(long) (stop_t.tv_sec - start_t.tv_sec),
|
(long) (stop_t.tv_sec - start_t.tv_sec),
|
||||||
(long) (stop_t.tv_usec - start_t.tv_usec),
|
(long) (stop_t.tv_usec - start_t.tv_usec),
|
||||||
query_string)));
|
print_statement ? " " : "",
|
||||||
|
print_statement ? query_string : "")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save_log_statement_stats)
|
if (save_log_statement_stats)
|
||||||
@ -2652,7 +2655,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.369 $ $Date: 2003/10/02 06:34:04 $\n");
|
puts("$Revision: 1.370 $ $Date: 2003/10/04 02:47:04 $\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user