Skip to content

Commit 34301c9

Browse files
committed
Add missing error code to "cannot attach index ..." error.
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE was used in an ereport with the same message but different errdetail a few lines earlier, so use that here as well. Backpatch-through: 11
1 parent 25fc24b commit 34301c9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/commands/tablecmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15977,7 +15977,8 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
1597715977
}
1597815978
if (!found)
1597915979
ereport(ERROR,
15980-
(errmsg("cannot attach index \"%s\" as a partition of index \"%s\"",
15980+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
15981+
errmsg("cannot attach index \"%s\" as a partition of index \"%s\"",
1598115982
RelationGetRelationName(partIdx),
1598215983
RelationGetRelationName(parentIdx)),
1598315984
errdetail("Index \"%s\" is not an index on any partition of table \"%s\".",

0 commit comments

Comments
 (0)