OSDN Git Service

Don't reset plpgsql nest level at every command end
[pghintplan/pg_hint_plan.git] / pg_hint_plan.c
index 78d2637..3afa34c 100644 (file)
@@ -4730,7 +4730,7 @@ void plpgsql_query_erase_callback(ResourceReleasePhase phase,
                                                                  bool isTopLevel,
                                                                  void *arg)
 {
-       if (phase != RESOURCE_RELEASE_AFTER_LOCKS)
+       if (!isTopLevel || phase != RESOURCE_RELEASE_AFTER_LOCKS)
                return;
        /* Cancel plpgsql nest level*/
        plpgsql_recurse_level = 0;