+ /*
+ * The arguments of EXECUTE are evaluated by a direct expression
+ * executor call.  This mode doesn't support session variables yet.
+ * It will be enabled later.
+ */
+ if (pstate->p_hasSessionVariables)
+ elog(ERROR, "session variable cannot be used as an argument");

it should be:
    /*
     * The arguments of CALL statement are evaluated by a direct expression
     * executor call.  This path is unsupported yet, so block it.
     */
    if (pstate->p_hasSessionVariables)
        ereport(ERROR,
                errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                errmsg("session variable cannot be used as an argument"));


similarly, EvaluateParams we can change it to
    /*
     * The arguments of EXECUTE are evaluated by a direct expression
     * executor call.  This mode doesn't support session variables yet.
     * It will be enabled later.
     */
    if (pstate->p_hasSessionVariables)
        ereport(ERROR,
                errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                errmsg("session variable cannot be used as an argument"));

in src/backend/executor/execExpr.c
we don't need
+#include "catalog/pg_variable.h"
?


Reply via email to