Skip to content

Commit c8961bf

Browse files
committed
Improve logging of protocol-level prepared statements.
1 parent ad269d5 commit c8961bf

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/backend/tcop/postgres.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.493 2006/07/29 03:02:56 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.494 2006/08/04 18:53:46 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1146,8 +1146,8 @@ exec_parse_message(const char *query_string, /* string to execute */
11461146

11471147
if (log_statement == LOGSTMT_ALL)
11481148
ereport(LOG,
1149-
(errmsg("statement: [protocol] PREPARE %s AS %s",
1150-
(*stmt_name != '\0') ? stmt_name : "<unnamed>",
1149+
(errmsg("statement: <protocol> PREPARE %s AS %s",
1150+
*stmt_name ? stmt_name : "<unnamed>",
11511151
query_string)));
11521152

11531153
/*
@@ -1452,7 +1452,9 @@ exec_bind_message(StringInfo input_message)
14521452
/* We need to output the parameter values someday */
14531453
if (log_statement == LOGSTMT_ALL)
14541454
ereport(LOG,
1455-
(errmsg("statement: [protocol] <BIND> %s", portal_name)));
1455+
(errmsg("statement: <protocol> <BIND> %s [PREPARE: %s]",
1456+
*portal_name ? portal_name : "<unnamed>",
1457+
portal->sourceText ? portal->sourceText : "")));
14561458

14571459
/*
14581460
* 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)
17181720
if (log_statement == LOGSTMT_ALL)
17191721
/* We have the portal, so output the source query. */
17201722
ereport(LOG,
1721-
(errmsg("statement: [protocol] %sEXECUTE %s [PREPARE: %s]",
1723+
(errmsg("statement: <protocol> %sEXECUTE %s [PREPARE: %s]",
17221724
execute_is_fetch ? "FETCH from " : "",
1723-
(*portal_name) ? portal_name : "<unnamed>",
1725+
*portal_name ? portal_name : "<unnamed>",
17241726
portal->sourceText ? portal->sourceText : "")));
17251727

17261728
BeginCommand(portal->commandTag, dest);
@@ -1826,11 +1828,11 @@ exec_execute_message(const char *portal_name, long max_rows)
18261828
secs, msecs)));
18271829
else
18281830
ereport(LOG,
1829-
(errmsg("duration: %ld.%03d ms statement: [protocol] %sEXECUTE %s [PREPARE: %s]",
1831+
(errmsg("duration: %ld.%03d ms statement: <protocol> %sEXECUTE %s [PREPARE: %s]",
18301832
secs, msecs,
18311833
execute_is_fetch ? "FETCH from " : "",
1832-
(*portal_name) ? portal_name : "<unnamed>",
1833-
portal->sourceText ? portal->sourceText : "")));
1834+
*portal_name ? portal_name : "<unnamed>",
1835+
portal->sourceText ? portal->sourceText : "")));
18341836
}
18351837
}
18361838

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy