diff --git a/src/backend/catalog/pg_variable.c b/src/backend/catalog/pg_variable.c
index f32d049bd59..bdee121cb57 100644
--- a/src/backend/catalog/pg_variable.c
+++ b/src/backend/catalog/pg_variable.c
@@ -350,6 +350,11 @@ VariableCreate(const char *varName,
 	referenced.objectSubId = 0;
 	recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
 
+	/* dependency on default expr */
+	if (varDefexpr)
+		recordDependencyOnExpr(&myself, (Node *) varDefexpr,
+							   NIL, DEPENDENCY_NORMAL);
+
 	/* dependency on any roles mentioned in ACL */
 	if (varacl != NULL)
 	{
diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c
index dde6a5acbdb..08cf7e63bbf 100644
--- a/src/backend/jit/llvm/llvmjit_expr.c
+++ b/src/backend/jit/llvm/llvmjit_expr.c
@@ -1088,8 +1088,8 @@ llvm_compile_expr(ExprState *state)
 
 			case EEOP_PARAM_VARIABLE:
 				build_EvalXFunc(b, mod, "ExecEvalParamVariable",
-								v_state, v_econtext, op);
-				LLVMBuildBr(b, opblocks[i + 1]);
+								v_state, op, v_econtext);
+				LLVMBuildBr(b, opblocks[opno + 1]);
 				break;
 
 			case EEOP_PARAM_CALLBACK:
