summaryrefslogtreecommitdiff
path: root/src/backend/tcop/utility.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/tcop/utility.c')
-rw-r--r--src/backend/tcop/utility.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 9578b5c7619..05ec7f3ac61 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -1347,10 +1347,16 @@ ProcessUtilitySlow(ParseState *pstate,
if (relkind != RELKIND_RELATION &&
relkind != RELKIND_MATVIEW &&
- relkind != RELKIND_PARTITIONED_TABLE)
+ relkind != RELKIND_PARTITIONED_TABLE &&
+ relkind != RELKIND_FOREIGN_TABLE)
+ elog(ERROR, "unexpected relkind \"%c\" on partition \"%s\"",
+ relkind, stmt->relation->relname);
+
+ if (relkind == RELKIND_FOREIGN_TABLE &&
+ (stmt->unique || stmt->primary))
ereport(ERROR,
- (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("cannot create index on partitioned table \"%s\"",
+ (errcode(ERRCODE_WRONG_OBJECT_TYPE),
+ errmsg("cannot create unique index on partitioned table \"%s\"",
stmt->relation->relname),
errdetail("Table \"%s\" contains partitions that are foreign tables.",
stmt->relation->relname)));