mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Clarify error message when attempting to create index on foreign table
Instead of just saying "is not a table", specifically state that indexes aren't supported on *foreign* tables.
This commit is contained in:
parent
fb3ad7895e
commit
d76a149c95
@ -183,10 +183,22 @@ DefineIndex(RangeVar *heapRelation,
|
|||||||
/* Note: during bootstrap may see uncataloged relation */
|
/* Note: during bootstrap may see uncataloged relation */
|
||||||
if (rel->rd_rel->relkind != RELKIND_RELATION &&
|
if (rel->rd_rel->relkind != RELKIND_RELATION &&
|
||||||
rel->rd_rel->relkind != RELKIND_UNCATALOGED)
|
rel->rd_rel->relkind != RELKIND_UNCATALOGED)
|
||||||
ereport(ERROR,
|
{
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
if (rel->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
|
||||||
errmsg("\"%s\" is not a table",
|
/*
|
||||||
heapRelation->relname)));
|
* Custom error message for FOREIGN TABLE since the term is
|
||||||
|
* close to a regular table and can confuse the user.
|
||||||
|
*/
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
|
errmsg("cannot create index on foreign table \"%s\"",
|
||||||
|
heapRelation->relname)));
|
||||||
|
else
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
|
errmsg("\"%s\" is not a table",
|
||||||
|
heapRelation->relname)));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't try to CREATE INDEX on temp tables of other backends.
|
* Don't try to CREATE INDEX on temp tables of other backends.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user