Add log display label for unnamed server-side portals.
authorBruce Momjian
Fri, 2 Sep 2005 21:50:54 +0000 (21:50 +0000)
committerBruce Momjian
Fri, 2 Sep 2005 21:50:54 +0000 (21:50 +0000)
src/backend/tcop/postgres.c

index aa0da207a3aa0fa156853fe91ca76c056aaf362c..f7d21c236211dd089c93119222e63ab023581822 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.457 2005/08/11 21:11:45 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.458 2005/09/02 21:50:54 momjian Exp $
  *
  * NOTES
  *   this is the "main" module of the postgres backend and
@@ -1164,7 +1164,9 @@ exec_parse_message(const char *query_string,  /* string to execute */
 
    if (log_statement == LOGSTMT_ALL)
        ereport(LOG,
-               (errmsg("statement: PREPARE %s AS %s", stmt_name, query_string)));
+               (errmsg("statement: PREPARE %s AS %s",
+                       (*stmt_name != '\0') ? stmt_name : "",
+                       query_string)));
 
    /*
     * Start up a transaction command so we can run parse analysis etc.
@@ -1732,7 +1734,8 @@ 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: EXECUTE %s  [PREPARE:  %s]", portal_name,
+               (errmsg("statement: EXECUTE %s  [PREPARE:  %s]",
+                       (*portal_name != '\0') ? portal_name : "",
                        portal->sourceText ? portal->sourceText : "")));
 
    BeginCommand(portal->commandTag, dest);
@@ -1867,7 +1870,7 @@ exec_execute_message(const char *portal_name, long max_rows)
                        (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,
-                           portal_name,
+                           (*portal_name != '\0') ? portal_name : "",
                            portal->sourceText ? portal->sourceText : "")));
    }