File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -183,10 +183,22 @@ DefineIndex(RangeVar *heapRelation,
183183 /* Note: during bootstrap may see uncataloged relation */
184184 if (rel -> rd_rel -> relkind != RELKIND_RELATION &&
185185 rel -> rd_rel -> relkind != RELKIND_UNCATALOGED )
186- ereport (ERROR ,
187- (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
188- errmsg ("\"%s\" is not a table" ,
189- heapRelation -> relname )));
186+ {
187+ if (rel -> rd_rel -> relkind == RELKIND_FOREIGN_TABLE )
188+ /*
189+ * Custom error message for FOREIGN TABLE since the term is
190+ * close to a regular table and can confuse the user.
191+ */
192+ ereport (ERROR ,
193+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
194+ errmsg ("cannot create index on foreign table \"%s\"" ,
195+ heapRelation -> relname )));
196+ else
197+ ereport (ERROR ,
198+ (errcode (ERRCODE_WRONG_OBJECT_TYPE ),
199+ errmsg ("\"%s\" is not a table" ,
200+ heapR
4D87
elation -> relname )));
201+ }
190202
191203 /*
192204 * Don't try to CREATE INDEX on temp tables of other backends.
You can’t perform that action at this time.
0 commit comments