8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.371 2003/10/08 03:49:37 momjian Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.372 2003/10/09 02:40:18 momjian Exp $
12
12
*
13
13
* NOTES
14
14
* this is the "main" module of the postgres backend and
@@ -461,7 +461,7 @@ pg_parse_query(const char *query_string)
461
461
462
462
if (log_statement )
463
463
ereport (LOG ,
464
- (errmsg ("query : %s" , query_string )));
464
+ (errmsg ("statement : %s" , query_string )));
465
465
466
466
if (log_parser_stats )
467
467
ResetUsage ();
@@ -943,7 +943,6 @@ exec_simple_query(const char *query_string)
943
943
if (save_log_duration || save_log_min_duration_statement != -1 )
944
944
{
945
945
long usecs ;
946
- bool print_statement ;
947
946
948
947
gettimeofday (& stop_t , NULL );
949
948
if (stop_t .tv_usec < start_t .tv_usec )
@@ -953,22 +952,26 @@ exec_simple_query(const char *query_string)
953
952
}
954
953
usecs = (long ) (stop_t .tv_sec - start_t .tv_sec ) * 1000000 + (long ) (stop_t .tv_usec - start_t .tv_usec );
955
954
955
+ if (save_log_duration )
956
+ ereport (LOG ,
957
+ (errmsg ("duration: %ld.%03ld ms" ,
958
+ (long ) ((stop_t .tv_sec - start_t .tv_sec ) * 1000 +
959
+ (stop_t .tv_usec - start_t .tv_usec ) / 1000 ),
960
+ (long ) (stop_t .tv_usec - start_t .tv_usec ) % 1000 )));
961
+
956
962
/*
957
963
* Output a duration_statement to the log if the query has exceeded
958
964
* the min duration, or if we are to print all durations.
959
965
*/
960
- print_statement = (save_log_min_duration_statement == 0 ||
961
- (save_log_min_duration_statement > 0 &&
962
- usecs >= save_log_min_duration_statement * 1000 ));
963
-
964
- if (save_log_duration || print_statement )
966
+ if (save_log_min_duration_statement == 0 ||
967
+ (save_log_min_duration_statement > 0 &&
968
+ usecs >= save_log_min_duration_statement * 1000 ))
965
969
ereport (LOG ,
966
- (errmsg ("duration: %ld.%03ld ms%s %s" ,
970
+ (errmsg ("duration: %ld.%03ld ms statement: %s" ,
967
971
(long ) ((stop_t .tv_sec - start_t .tv_sec ) * 1000 +
968
972
(stop_t .tv_usec - start_t .tv_usec ) / 1000 ),
969
973
(long ) (stop_t .tv_usec - start_t .tv_usec ) % 1000 ,
970
- print_statement ? " query: " : "" ,
971
- print_statement ? query_string : "" )));
974
+ query_string )));
972
975
}
973
976
974
977
if (save_log_statement_stats )
@@ -2657,7 +2660,7 @@ PostgresMain(int argc, char *argv[], const char *username)
2657
2660
if (!IsUnderPostmaster )
2658
2661
{
2659
2662
puts ("\nPOSTGRES backend interactive interface " );
2660
- puts ("$Revision: 1.371 $ $Date: 2003/10/08 03:49:37 $\n" );
2663
+ puts ("$Revision: 1.372 $ $Date: 2003/10/09 02:40:18 $\n" );
2661
2664
}
2662
2665
2663
2666
/*
0 commit comments