Commit 6e481ebf authored by Tom Lane's avatar Tom Lane

Improve error message when an FDW doesn't support WHERE CURRENT OF.

If an FDW fails to take special measures with a CurrentOfExpr, we will
end up trying to execute it as an ordinary qual, which was being treated
as a purely internal failure condition.  Provide a more user-oriented
error message for such cases.
parent 3353583d
...@@ -4257,16 +4257,20 @@ ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate, ...@@ -4257,16 +4257,20 @@ ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate,
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* ExecEvalCurrentOfExpr * ExecEvalCurrentOfExpr
* *
* The planner must convert CURRENT OF into a TidScan qualification. * The planner should convert CURRENT OF into a TidScan qualification, or some
* So, we have to be able to do ExecInitExpr on a CurrentOfExpr, * other special handling in a ForeignScan node. So we have to be able to do
* but we shouldn't ever actually execute it. * ExecInitExpr on a CurrentOfExpr, but we shouldn't ever actually execute it.
* If we get here, we suppose we must be dealing with CURRENT OF on a foreign
* table whose FDW doesn't handle it, and complain accordingly.
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
static Datum static Datum
ExecEvalCurrentOfExpr(ExprState *exprstate, ExprContext *econtext, ExecEvalCurrentOfExpr(ExprState *exprstate, ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone) bool *isNull, ExprDoneCond *isDone)
{ {
elog(ERROR, "CURRENT OF cannot be executed"); ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("WHERE CURRENT OF is not supported for this table type")));
return 0; /* keep compiler quiet */ return 0; /* keep compiler quiet */
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment