]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Add missing error code to "cannot attach index ..." error.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 28 May 2020 09:37:00 +0000 (12:37 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 28 May 2020 09:37:56 +0000 (12:37 +0300)
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

src/backend/commands/tablecmds.c

index bc66d6c4f5f1de4cad4b04701e6d579c0d671f58..4c6692e1ab8ebf555fa8b0d1decbb28816da9977 100644 (file)
@@ -15977,7 +15977,8 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
                }
                if (!found)
                        ereport(ERROR,
-                                       (errmsg("cannot attach index \"%s\" as a partition of index \"%s\"",
+                                       (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+                                        errmsg("cannot attach index \"%s\" as a partition of index \"%s\"",
                                                        RelationGetRelationName(partIdx),
                                                        RelationGetRelationName(parentIdx)),
                                         errdetail("Index \"%s\" is not an index on any partition of table \"%s\".",