Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6e481eb

Browse files
committed
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.
1 parent 3353583 commit 6e481eb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/backend/executor/execQual.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4257,16 +4257,20 @@ ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate,
42574257
/* ----------------------------------------------------------------
42584258
* ExecEvalCurrentOfExpr
42594259
*
4260-
* The planner must convert CURRENT OF into a TidScan qualification.
4261-
* So, we have to be able to do ExecInitExpr on a CurrentOfExpr,
4262-
* but we shouldn't ever actually execute it.
4260+
* The planner should convert CURRENT OF into a TidScan qualification, or some
4261+
* other special handling in a ForeignScan node. So we have to be able to do
4262+
* ExecInitExpr on a CurrentOfExpr, but we shouldn't ever actually execute it.
4263+
* If we get here, we suppose we must be dealing with CURRENT OF on a foreign
4264+
* table whose FDW doesn't handle it, and complain accordingly.
42634265
* ----------------------------------------------------------------
42644266
*/
42654267
static Datum
42664268
ExecEvalCurrentOfExpr(ExprState *exprstate, ExprContext *econtext,
42674269
bool *isNull, ExprDoneCond *isDone)
42684270
{
4269-
elog(ERROR, "CURRENT OF cannot be executed");
4271+
ereport(ERROR,
4272+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
4273+
errmsg("WHERE CURRENT OF is not supported for this table type")));
42704274
return 0; /* keep compiler quiet */
42714275
}
42724276

0 commit comments

Comments
 (0)