aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execQual.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-04-19 16:14:56 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2013-04-19 16:14:56 -0400
commit6e481ebff6368cb0ab5351a5ef3463747c35af22 (patch)
treeacfcb9ac105f62478542b991f5af8b05ddf03cc8 /src/backend/executor/execQual.c
parent3353583d7ecf7c9f8bc5966ed0a2537dec71ffdc (diff)
downloadpostgresql-6e481ebff6368cb0ab5351a5ef3463747c35af22.tar.gz
postgresql-6e481ebff6368cb0ab5351a5ef3463747c35af22.zip
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.
Diffstat (limited to 'src/backend/executor/execQual.c')
-rw-r--r--src/backend/executor/execQual.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 330d889eba9..4ea0cbadadb 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -4257,16 +4257,20 @@ ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate,
/* ----------------------------------------------------------------
* ExecEvalCurrentOfExpr
*
- * The planner must convert CURRENT OF into a TidScan qualification.
- * So, we have to be able to do ExecInitExpr on a CurrentOfExpr,
- * but we shouldn't ever actually execute it.
+ * The planner should convert CURRENT OF into a TidScan qualification, or some
+ * other special handling in a ForeignScan node. So we have to be able to do
+ * 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
ExecEvalCurrentOfExpr(ExprState *exprstate, ExprContext *econtext,
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 */
}