8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.370 2003/10/04 02:47:04 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.371 2003/10/08 03:49:37 momjian Exp $
12
12
*
13
13
* NOTES
14
14
* this is the "main" module of the postgres backend and
@@ -694,7 +694,7 @@ exec_simple_query(const char *query_string)
694
694
* because gettimeofday() wasn't called. Similarly,
695
695
* log_statement_stats has to be captured once.
696
696
*/
697
- if (save_log_duration || save_log_min_duration_statement > 0 )
697
+ if (save_log_duration || save_log_min_duration_statement != -1 )
698
698
gettimeofday (& start_t , NULL );
699
699
700
700
if (save_log_statement_stats )
@@ -940,7 +940,7 @@ exec_simple_query(const char *query_string)
940
940
* Combine processing here as we need to calculate the query duration
941
941
* in both instances.
942
942
*/
943
- if (save_log_duration || save_log_min_duration_statement > 0 )
943
+ if (save_log_duration || save_log_min_duration_statement != -1 )
944
944
{
945
945
long usecs ;
946
946
bool print_statement ;
@@ -957,15 +957,17 @@ exec_simple_query(const char *query_string)
957
957
* Output a duration_statement to the log if the query has exceeded
958
958
* the min duration, or if we are to print all durations.
959
959
*/
960
- print_statement = (save_log_min_duration_statement > 0 &&
961
- usecs >= save_log_min_duration_statement * 1000 );
960
+ print_statement = (save_log_min_duration_statement == 0 ||
961
+ (save_log_min_duration_statement > 0 &&
962
+ usecs >= save_log_min_duration_statement * 1000 ));
962
963
963
964
if (save_log_duration || print_statement )
964
965
ereport (LOG ,
965
- (errmsg ("duration(secs): %ld.%06ld%s%s" ,
966
- (long ) (stop_t .tv_sec - start_t .tv_sec ),
967
- (long ) (stop_t .tv_usec - start_t .tv_usec ),
968
- print_statement ? " " : "" ,
966
+ (errmsg ("duration: %ld.%03ld ms%s%s" ,
967
+ (long ) ((stop_t .tv_sec - start_t .tv_sec ) * 1000 +
968
+ (stop_t .tv_usec - start_t .tv_usec ) / 1000 ),
969
+ (long ) (stop_t .tv_usec - start_t .tv_usec ) % 1000 ,
970
+ print_statement ? " query: " : "" ,
969
971
print_statement ? query_string : "" )));
970
972
}
971
973
@@ -2655,7 +2657,7 @@ PostgresMain(int argc, char *argv[], const char *username)
2655
2657
if (!IsUnderPostmaster )
2656
2658
{
2657
2659
puts ("\nPOSTGRES backend interactive interface " );
2658
- puts ("$Revision: 1.370 $ $Date: 2003/10/04 02:47:04 $\n" );
2660
+ puts ("$Revision: 1.371 $ $Date: 2003/10/08 03:49:37 $\n" );
2659
2661
}
2660
2662
2661
2663
/*
@@ -3196,3 +3198,4 @@ ShowUsage(const char *title)
3196
3198
3197
3199
pfree (str .data );
3198
3200
}
3201
+
0 commit comments