Index: doc/src/sgml/runtime.sgml =================================================================== RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/runtime.sgml,v retrieving revision 1.284 diff -C1 -r1.284 runtime.sgml *** doc/src/sgml/runtime.sgml 26 Sep 2004 22:51:49 -0000 1.284 --- doc/src/sgml/runtime.sgml 28 Sep 2004 02:19:16 -0000 *************** *** 2305,2313 **** ! Causes the duration of every completed statement to be logged. ! To use this option, it is recommended that you also enable ! log_statement and if not using syslog ! log the PID using log_line_prefix so that you ! can link the statement to the duration using the process ! ID. The default is off. Only superusers can turn off this ! option if it is enabled by the administrator. --- 2305,2314 ---- ! Causes the duration of every completed statement which satisfies ! log_statement directive to be logged. ! When using this option, if you are not using syslog, ! it is recommended that you log the PID or session ID using ! log_line_prefix or log the session ID so that you can ! link the statement to the duration using the process ID or session ! ID. The default is off. Only superusers can turn off this option ! if it is enabled by the administrator. Index: src/backend/tcop/postgres.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/tcop/postgres.c,v retrieving revision 1.433 diff -C1 -r1.433 postgres.c *** src/backend/tcop/postgres.c 26 Sep 2004 00:26:25 -0000 1.433 --- src/backend/tcop/postgres.c 28 Sep 2004 02:19:19 -0000 *************** *** 83,84 **** --- 83,87 ---- + /* flag noting if the statement satisfies log_statement directive */ + bool loggable_statement; + /* GUC variable for maximum stack depth (measured in kilobytes) */ *************** *** 465,469 **** --- 468,476 ---- + loggable_statement = false; if (log_statement == LOGSTMT_ALL) + { ereport(LOG, (errmsg("statement: %s", query_string))); + loggable_statement = true; + } *************** *** 503,504 **** --- 510,512 ---- (errmsg("statement: %s", query_string))); + loggable_statement = true; break; *************** *** 514,515 **** --- 522,524 ---- (errmsg("statement: %s", query_string))); + loggable_statement = true; break; *************** *** 1005,1007 **** ! if (save_log_duration) ereport(LOG, --- 1014,1023 ---- ! /* ! * If log_duration = true, don't log duration unless statement ! * statement also satifies log_statement directive. Otherwise, ! * the duration statements are devoid of context without their ! * query having been logged. Note the statement still may be ! * below due to log_min_duration_statement directive. ! */ ! if (loggable_statement && save_log_duration) ereport(LOG,