We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentfb3ad78 commitd76a149Copy full SHA for d76a149
src/backend/commands/indexcmds.c
@@ -183,10 +183,22 @@ DefineIndex(RangeVar *heapRelation,
183
/* Note: during bootstrap may see uncataloged relation */
184
if (rel->rd_rel->relkind!=RELKIND_RELATION&&
185
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)));
+{
+if (rel->rd_rel->relkind==RELKIND_FOREIGN_TABLE)
+/*
+ * 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
198
199
+errmsg("\"%s\" is not a table",
200
201
+}
202
203
/*
204
* Don't try to CREATE INDEX on temp tables of other backends.