From c8961bf1ce0b51019db31c5572dac18b664e02f1 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 4 Aug 2006 18:53:46 +0000 Subject: [PATCH] Improve logging of protocol-level prepared statements. --- src/backend/tcop/postgres.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 1f8cda61b3..df10e285c1 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.493 2006/07/29 03:02:56 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.494 2006/08/04 18:53:46 momjian Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -1146,8 +1146,8 @@ exec_parse_message(const char *query_string, /* string to execute */ if (log_statement == LOGSTMT_ALL) ereport(LOG, - (errmsg("statement: [protocol] PREPARE %s AS %s", - (*stmt_name != '\0') ? stmt_name : "", + (errmsg("statement: PREPARE %s AS %s", + *stmt_name ? stmt_name : "", query_string))); /* @@ -1452,7 +1452,9 @@ exec_bind_message(StringInfo input_message) /* We need to output the parameter values someday */ if (log_statement == LOGSTMT_ALL) ereport(LOG, - (errmsg("statement: [protocol] %s", portal_name))); + (errmsg("statement: %s [PREPARE: %s]", + *portal_name ? portal_name : "", + portal->sourceText ? portal->sourceText : ""))); /* * Fetch parameters, if any, and store in the portal's memory context. @@ -1718,9 +1720,9 @@ exec_execute_message(const char *portal_name, long max_rows) if (log_statement == LOGSTMT_ALL) /* We have the portal, so output the source query. */ ereport(LOG, - (errmsg("statement: [protocol] %sEXECUTE %s [PREPARE: %s]", + (errmsg("statement: %sEXECUTE %s [PREPARE: %s]", execute_is_fetch ? "FETCH from " : "", - (*portal_name) ? portal_name : "", + *portal_name ? portal_name : "", portal->sourceText ? portal->sourceText : ""))); BeginCommand(portal->commandTag, dest); @@ -1826,11 +1828,11 @@ exec_execute_message(const char *portal_name, long max_rows) secs, msecs))); else ereport(LOG, - (errmsg("duration: %ld.%03d ms statement: [protocol] %sEXECUTE %s [PREPARE: %s]", + (errmsg("duration: %ld.%03d ms statement: %sEXECUTE %s [PREPARE: %s]", secs, msecs, execute_is_fetch ? "FETCH from " : "", - (*portal_name) ? portal_name : "", - portal->sourceText ? portal->sourceText : ""))); + *portal_name ? portal_name : "", + portal->sourceText ? portal->sourceText : ""))); } }