summaryrefslogtreecommitdiff
path: root/src/include/tcop
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-09-07 22:52:01 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-09-07 22:52:01 +0000
commit893632be4e17ccd791cfda17d2e99bb2312f6ff8 (patch)
treeeb97eafe66b6413bbf910916f4150d76c05f3c47 /src/include/tcop
parentb6eab50ce4d49fbbbc7cd9dba32ce86afb3f8c4a (diff)
downloadpostgresql-893632be4e17ccd791cfda17d2e99bb2312f6ff8.tar.gz
Clean up logging for extended-query-protocol operations, as per my recent
proposal. Parameter logging works even for binary-format parameters, and logging overhead is avoided when disabled. log_statement = all output for the src/test/examples/testlibpq3.c example now looks like LOG: statement: execute <unnamed>: SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: statement: execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' and log_min_duration_statement = 0 results in LOG: duration: 2.431 ms parse <unnamed>: SELECT * FROM test1 WHERE t = $1 LOG: duration: 2.335 ms bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: duration: 0.394 ms execute <unnamed>: SELECT * FROM test1 WHERE t = $1 DETAIL: parameters: $1 = 'joe''s place' LOG: duration: 1.251 ms parse <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 LOG: duration: 0.566 ms bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' LOG: duration: 0.173 ms execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4 DETAIL: parameters: $1 = '2' (This example demonstrates the folly of ignoring parse/bind steps for duration logging purposes, BTW.) Along the way, create a less ad-hoc mechanism for determining which commands are logged by log_statement = mod and log_statement = ddl. The former coding was actually missing quite a few things that look like ddl to me, and it did not handle EXECUTE or extended query protocol correctly at all. This commit does not do anything about the question of whether log_duration should be removed or made less redundant with log_min_duration_statement.
Diffstat (limited to 'src/include/tcop')
-rw-r--r--src/include/tcop/utility.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/include/tcop/utility.h b/src/include/tcop/utility.h
index 6674dec129..985cfb507b 100644
--- a/src/include/tcop/utility.h
+++ b/src/include/tcop/utility.h
@@ -7,14 +7,14 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/tcop/utility.h,v 1.28 2006/08/12 20:05:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/tcop/utility.h,v 1.29 2006/09/07 22:52:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef UTILITY_H
#define UTILITY_H
-#include "executor/execdesc.h"
+#include "tcop/tcopprot.h"
extern void ProcessUtility(Node *parsetree, ParamListInfo params,
@@ -28,6 +28,10 @@ extern const char *CreateCommandTag(Node *parsetree);
extern const char *CreateQueryTag(Query *parsetree);
+extern LogStmtLevel GetCommandLogLevel(Node *parsetree);
+
+extern LogStmtLevel GetQueryLogLevel(Query *parsetree);
+
extern bool QueryReturnsTuples(Query *parsetree);
extern bool QueryIsReadOnly(Query *parsetree);