OSDN Git Service

Fix behavior for pg_hint_plan.debug_print
authormikecaat <righttoleft1134@gmail.com>
Tue, 18 Jan 2022 06:54:59 +0000 (15:54 +0900)
committerKyotaro Horiguchi <horikyota.ntt@gmail.com>
Tue, 18 Jan 2022 07:03:03 +0000 (16:03 +0900)
It was a kind of broken that some debug code paths are never visited
or that higher debug_level doesn't offer detailed messages.
Fix some debug messages' debug_level condition so that we can see the
proper messages for every debug_level.

pg_hint_plan.c

index 5a044b8..7cdfbe8 100644 (file)
@@ -2921,7 +2921,7 @@ get_current_hint_string(Query *query, const char *query_str,
 
        if (debug_level > 1)
        {
-               if (debug_level == 1 && query_str && debug_query_string &&
+               if (debug_level == 2 && query_str && debug_query_string &&
                        strcmp(query_str, debug_query_string))
                        ereport(pg_hint_plan_debug_message_level,
                                        (errmsg("hints in comment=\"%s\"",
@@ -3570,7 +3570,7 @@ restrict_indexes(PlannerInfo *root, ScanMethodHint *hint, RelOptInfo *rel,
                pfree(indexname);
        }
 
-       if (debug_level == 1)
+       if (debug_level > 0)
        {
                StringInfoData  rel_buf;
                char *disprelname = "";