Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd76a149

Browse files
committed
Clarify error message when attempting to create index on foreign table
Instead of just saying "is not a table", specifically state thatindexes aren't supported on *foreign* tables.
1 parentfb3ad78 commitd76a149

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

‎src/backend/commands/indexcmds.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff 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+
heapRelation->relname)));
201+
}
190202

191203
/*
192204
* Don't try to CREATE INDEX on temp tables of other backends.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp