• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

firtst release


Commit MetaInfo

Révision4e63a22d0aeb67b03f05ddc689f25e8a0b27ef91 (tree)
l'heure2020-02-17 21:08:43
AuteurKyotaro Horiguchi <horikyota.ntt@gmai...>
CommiterKyotaro Horiguchi

Message de Log

Restore current hint state when returned from non-hinted query planning.

If no hint is given for the current level query, pg_hint_plan_planner
calls the next level of planner after erasing the
current_hint_state. But it forgot to restore the state before the
planning of the rest part of the current-level query. It is broken by
the commit 958c60d but overlooked among vast amount of behavioral
changes.. Get back the behavior by restoring current_hint_state after
returned from the lower level planner with unhinted query.

Issue: https://github.com/ossc-db/pg_hint_plan/issues/30
Reported-by: higuchi-daisuke

Change Summary

Modification

--- a/expected/ut-A.out
+++ b/expected/ut-A.out
@@ -4260,7 +4260,12 @@ SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1)
42604260 ORDER BY t_1.c1 LIMIT 1"
42614261 PL/pgSQL function nested_planner(integer) line 12 at SQL statement
42624262 LOG: pg_hint_plan:
4263-no hint
4263+used hint:
4264+IndexScan(t_1)
4265+not used hint:
4266+duplication hint:
4267+error hint:
4268+
42644269 CONTEXT: SQL statement "SELECT /*+ IndexScan(t_1) */ nested_planner(cnt - 1) FROM s1.t1 t_1
42654270 JOIN s1.t2 t_2 ON (t_1.c1 = t_2.c1)
42664271 ORDER BY t_1.c1 LIMIT 1"
--- a/pg_hint_plan.c
+++ b/pg_hint_plan.c
@@ -2863,9 +2863,15 @@ standard_planner_proc:
28632863 }
28642864 current_hint = NULL;
28652865 if (prev_planner)
2866- return (*prev_planner) (parse, cursorOptions, boundParams);
2866+ result = (*prev_planner) (parse, cursorOptions, boundParams);
28672867 else
2868- return standard_planner(parse, cursorOptions, boundParams);
2868+ result = standard_planner(parse, cursorOptions, boundParams);
2869+
2870+ /* The upper-level planner still needs the current hint state */
2871+ if (HintStateStack != NIL)
2872+ current_hint = (HintState *) lfirst(list_head(HintStateStack));
2873+
2874+ return result;
28692875 }
28702876
28712877 /*