Index: src/backend/tcop/postgres.c =================================================================== RCS file: /cvsroot/pgsql-server/src/backend/tcop/postgres.c,v retrieving revision 1.371 diff -c -c -r1.371 postgres.c *** src/backend/tcop/postgres.c 8 Oct 2003 03:49:37 -0000 1.371 --- src/backend/tcop/postgres.c 9 Oct 2003 02:37:19 -0000 *************** *** 461,467 **** if (log_statement) ereport(LOG, ! (errmsg("query: %s", query_string))); if (log_parser_stats) ResetUsage(); --- 461,467 ---- if (log_statement) ereport(LOG, ! (errmsg("statement: %s", query_string))); if (log_parser_stats) ResetUsage(); *************** *** 943,949 **** if (save_log_duration || save_log_min_duration_statement != -1) { long usecs; - bool print_statement; gettimeofday(&stop_t, NULL); if (stop_t.tv_usec < start_t.tv_usec) --- 943,948 ---- *************** *** 953,974 **** } usecs = (long) (stop_t.tv_sec - start_t.tv_sec) * 1000000 + (long) (stop_t.tv_usec - start_t.tv_usec); /* * 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 || ! (save_log_min_duration_statement > 0 && ! usecs >= save_log_min_duration_statement * 1000)); ! ! if (save_log_duration || print_statement) ereport(LOG, ! (errmsg("duration: %ld.%03ld ms%s%s", (long) ((stop_t.tv_sec - start_t.tv_sec) * 1000 + (stop_t.tv_usec - start_t.tv_usec) / 1000), (long) (stop_t.tv_usec - start_t.tv_usec) % 1000, ! print_statement ? " query: " : "", ! print_statement ? query_string : ""))); } if (save_log_statement_stats) --- 952,977 ---- } usecs = (long) (stop_t.tv_sec - start_t.tv_sec) * 1000000 + (long) (stop_t.tv_usec - start_t.tv_usec); + if (save_log_duration) + ereport(LOG, + (errmsg("duration: %ld.%03ld ms", + (long) ((stop_t.tv_sec - start_t.tv_sec) * 1000 + + (stop_t.tv_usec - start_t.tv_usec) / 1000), + (long) (stop_t.tv_usec - start_t.tv_usec) % 1000))); + /* * 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_min_duration_statement == 0 || ! (save_log_min_duration_statement > 0 && ! usecs >= save_log_min_duration_statement * 1000)) ereport(LOG, ! (errmsg("duration: %ld.%03ld ms statement: %s", (long) ((stop_t.tv_sec - start_t.tv_sec) * 1000 + (stop_t.tv_usec - start_t.tv_usec) / 1000), (long) (stop_t.tv_usec - start_t.tv_usec) % 1000, ! query_string))); } if (save_log_statement_stats)