OSDN Git Service

Remove an useless variable
authorKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Mon, 7 Jan 2019 07:40:21 +0000 (16:40 +0900)
committerKyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Mon, 7 Jan 2019 10:08:30 +0000 (19:08 +0900)
commit c05bb31 made the variable stmt_name useless. Remove it.

pg_hint_plan.c

index f9eeabd..6048f30 100644 (file)
@@ -554,12 +554,6 @@ static HintState *current_hint_state = NULL;
  */
 static List *HintStateStack = NIL;
 
-/*
- * Holds statement name during executing EXECUTE command.  NULL for other
- * statements.
- */
-static char       *stmt_name = NULL;
-
 static const HintParser parsers[] = {
        {HINT_SEQSCAN, ScanMethodHintCreate, HINT_KEYWORD_SEQSCAN},
        {HINT_INDEXSCAN, ScanMethodHintCreate, HINT_KEYWORD_INDEXSCAN},
@@ -2904,8 +2898,8 @@ pg_hint_plan_post_parse_analyze(ParseState *pstate, Query *query)
 
        if (debug_level > 1)
        {
-               if (debug_level == 1 &&
-                       (stmt_name || strcmp(query_str, debug_query_string)))
+               if (debug_level == 1 && query_str && debug_query_string &&
+                       strcmp(query_str, debug_query_string))
                        ereport(pg_hint_plan_debug_message_level,
                                        (errmsg("hints in comment=\"%s\"",
                                                        current_hint_str ? current_hint_str : "(none)"),
@@ -2913,9 +2907,10 @@ pg_hint_plan_post_parse_analyze(ParseState *pstate, Query *query)
                                         errhidecontext(msgqno != qno)));
                else
                        ereport(pg_hint_plan_debug_message_level,
-                                       (errmsg("hints in comment=\"%s\", stmt=\"%s\", query=\"%s\", debug_query_string=\"%s\"",
+                                       (errmsg("hints in comment=\"%s\", query=\"%s\", debug_query_string=\"%s\"",
                                                        current_hint_str ? current_hint_str : "(none)",
-                                                       stmt_name, query_str, debug_query_string),
+                                                       query_str ? query_str : "(none)",
+                                                       debug_query_string ? debug_query_string : "(none)"),
                                         errhidestmt(msgqno != qno),
                                         errhidecontext(msgqno != qno)));
                msgqno = qno;