agora inbox for [email protected]
help / color / mirror / Atom feedFrom: Alvaro Herrera <[email protected]>
Subject: [PATCH v8 1/3] fix CompareIndexInfo-related bugs
Date: Tue, 26 Mar 2019 17:05:07 -0300
---
src/backend/catalog/index.c | 3 +--
src/backend/commands/indexcmds.c | 1 -
src/backend/commands/tablecmds.c | 2 +-
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index d2e284f6de6..c0417d4c5a2 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -1850,7 +1850,6 @@ CompareIndexInfo(IndexInfo *info1, IndexInfo *info2,
if (info1->ii_NumIndexKeyAttrs != info2->ii_NumIndexKeyAttrs)
return false;
-
/*
* and columns match through the attribute map (actual attribute numbers
* might differ!) Note that this implies that index columns that are
@@ -1859,7 +1858,7 @@ CompareIndexInfo(IndexInfo *info1, IndexInfo *info2,
*/
for (i = 0; i < info1->ii_NumIndexAttrs; i++)
{
- if (maplen < info2->ii_IndexAttrNumbers[i])
+ if (maplen < info2->ii_IndexAttrNumbers[i] - 1)
elog(ERROR, "incorrect attribute map");
/* ignore expressions at this stage */
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index c3a53d81aab..d6eb48cb4e6 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -925,7 +925,6 @@ DefineIndex(Oid relationId,
gettext_noop("could not convert row type"));
maplen = parentDesc->natts;
-
foreach(cell, childidxs)
{
Oid cldidxid = lfirst_oid(cell);
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 3183b2aaa12..048c1196685 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -15591,7 +15591,7 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
partIdx->rd_opfamily,
parentIdx->rd_opfamily,
attmap,
- RelationGetDescr(partTbl)->natts))
+ RelationGetDescr(parentTbl)->natts))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("cannot attach index \"%s\" as a partition of index \"%s\"",
--
2.17.1
--zYM0uCDKw75PZbzx
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v8-0002-Rework-deleteObjectsInList-to-allow-objtype-speci.patch"
view thread (74+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH v8 1/3] fix CompareIndexInfo-related bugs
In-Reply-To: <no-message-id-1883708@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox