diff options
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index c632d1e8245..f53129a1c48 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17296,9 +17296,14 @@ ATExecReplicaIdentity(Relation rel, ReplicaIdentityStmt *stmt, LOCKMODE lockmode errmsg("\"%s\" is not an index for table \"%s\"", RelationGetRelationName(indexRel), RelationGetRelationName(rel)))); - /* The AM must support uniqueness, and the index must in fact be unique. */ - if (!indexRel->rd_indam->amcanunique || - !indexRel->rd_index->indisunique) + /* + * The AM must support uniqueness, and the index must in fact be unique. + * If we have a WITHOUT OVERLAPS constraint (identified by uniqueness + + * exclusion), we can use that too. + */ + if ((!indexRel->rd_indam->amcanunique || + !indexRel->rd_index->indisunique) && + !(indexRel->rd_index->indisunique && indexRel->rd_index->indisexclusion)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot use non-unique index \"%s\" as replica identity", |