Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/tcop/postgres.c,v
retrieving revision 1.369
diff -c -c -r1.369 postgres.c
*** src/backend/tcop/postgres.c	2 Oct 2003 06:34:04 -0000	1.369
--- src/backend/tcop/postgres.c	4 Oct 2003 02:45:50 -0000
***************
*** 943,948 ****
--- 943,949 ----
  	if (save_log_duration || save_log_min_duration_statement > 0)
  	{
  		long		usecs;
+ 		bool		print_statement;
  
  		gettimeofday(&stop_t, NULL);
  		if (stop_t.tv_usec < start_t.tv_usec)
***************
*** 956,969 ****
  		 * Output a duration_statement to the log if the query has exceeded
  		 * the min duration, or if we are to print all durations.
  		 */
! 		if (save_log_duration ||
! 			(save_log_min_duration_statement > 0 &&
! 			 usecs >= save_log_min_duration_statement * 1000))
  			ereport(LOG,
! 					(errmsg("duration: %ld.%06ld %s",
  							(long) (stop_t.tv_sec - start_t.tv_sec),
  							(long) (stop_t.tv_usec - start_t.tv_usec),
! 							query_string)));
  	}
  
  	if (save_log_statement_stats)
--- 957,972 ----
  		 * Output a duration_statement to the log if the query has exceeded
  		 * the min duration, or if we are to print all durations.
  		 */
! 		print_statement = (save_log_min_duration_statement > 0 &&
! 						   usecs >= save_log_min_duration_statement * 1000);
! 
! 		if (save_log_duration || print_statement)
  			ereport(LOG,
! 					(errmsg("duration(secs): %ld.%06ld%s%s",
  							(long) (stop_t.tv_sec - start_t.tv_sec),
  							(long) (stop_t.tv_usec - start_t.tv_usec),
! 							print_statement ? " " : "",
! 							print_statement ? query_string : "")));
  	}
  
  	if (save_log_statement_stats)
