OSDN Git Service

Do null-check of error_context_stack before use
[pghintplan/pg_hint_plan.git] / pg_hint_plan.c
index 1a169d3..a6c9a38 100644 (file)
@@ -3014,6 +3014,8 @@ pg_hint_plan_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
         * Support for nested plpgsql functions. This is quite ugly but this is the
         * only point I could find where I can get the query string.
         */
+       if (plpgsql_recurse_level > 0 &&
+               error_context_stack && error_context_stack->arg)
        if (plpgsql_recurse_level > 0)
        {
                MemoryContext oldcontext;