SELECT ft1.c1, ft2.c2, ft1.c8 FROM ft1, ft2 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = 1; -- ERROR
ERROR: invalid input syntax for integer: "foo"
CONTEXT: column "c8" of foreign table "ft1"
+SELECT ft1.c1, ft2.c2, ft1 FROM ft1, ft2 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = 1; -- ERROR
+ERROR: invalid input syntax for integer: "foo"
+CONTEXT: whole-row reference to foreign table "ft1"
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE user_enum;
-- ===================================================================
-- subtransaction
{
const char *attname = NULL;
const char *relname = NULL;
+ bool is_wholerow = false;
ConversionLocation *errpos = (ConversionLocation *) arg;
if (errpos->rel)
Assert(IsA(var, Var));
rte = rt_fetch(var->varno, estate->es_range_table);
+
+ if (var->varattno == 0)
+ is_wholerow = true;
+ else
+ attname = get_relid_attribute_name(rte->relid, var->varattno);
+
relname = get_rel_name(rte->relid);
- attname = get_relid_attribute_name(rte->relid, var->varattno);
}
- if (attname && relname)
- errcontext("column \"%s\" of foreign table \"%s\"", attname, relname);
+ if (relname)
+ {
+ if (is_wholerow)
+ errcontext("whole-row reference to foreign table \"%s\"", relname);
+ else if (attname)
+ errcontext("column \"%s\" of foreign table \"%s\"", attname, relname);
+ }
}
/*
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE int;
SELECT * FROM ft1 WHERE c1 = 1; -- ERROR
SELECT ft1.c1, ft2.c2, ft1.c8 FROM ft1, ft2 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = 1; -- ERROR
+SELECT ft1.c1, ft2.c2, ft1 FROM ft1, ft2 WHERE ft1.c1 = ft2.c1 AND ft1.c1 = 1; -- ERROR
ALTER FOREIGN TABLE ft1 ALTER COLUMN c8 TYPE user_enum;
-- ===================================================================