diff --git i/src/backend/executor/execExpr.c w/src/backend/executor/execExpr.c index f1569879b52..2972af3c189 100644 --- i/src/backend/executor/execExpr.c +++ w/src/backend/executor/execExpr.c @@ -346,6 +346,7 @@ ExecInitExprList(List *nodes, PlanState *parent) return result; } +#include "nodes/print.h" /* * ExecBuildProjectionInfo @@ -399,6 +400,24 @@ ExecBuildProjectionInfo(List *targetList, AttrNumber attnum = 0; bool isSafeVar = false; + if (slot && tle->expr != NULL) + { + Oid expr_type = exprType((Node *) tle->expr); + Form_pg_attribute slot_attr = TupleDescAttr(slot->tts_tupleDescriptor, tle->resno - 1); + Oid slot_type = slot_attr->atttypid; + + if (expr_type != slot_type) + { + elog(WARNING, "type mismatch: resno %d: slot (type: %d, name: %s) vs expr (type: %d, name: %s)", + tle->resno, slot_type, + NameStr(slot_attr->attname), + expr_type, + tle->resname + ); + elog_node_display(WARNING, "TargetEntry", tle, true); + } + } + /* * If tlist expression is a safe non-system Var, use the fast-path * ASSIGN_*_VAR opcodes. "Safe" means that we don't need to apply