Skip to content

Commit 346ded6

Browse files
authored
Merge pull request #156134 from cockroachdb/blathers/backport-release-25.2-156105
release-25.2: sql/opt_catalog: Use index offset as tombstone index ordinal
2 parents 1d500d0 + 4f990ef commit 346ded6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pkg/sql/opt_catalog.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,12 +1145,13 @@ func newOptTable(
11451145
canUseTombstones := idx.ImplicitPartitioningColumnCount() == 1 &&
11461146
partitionColumn.GetType().Family() == types.EnumFamily
11471147
ot.uniqueConstraints = append(ot.uniqueConstraints, optUniqueConstraint{
1148-
name: idx.GetName(),
1149-
table: ot.ID(),
1150-
columns: idx.IndexDesc().KeyColumnIDs[idx.IndexDesc().ExplicitColumnStartIdx():],
1151-
withoutIndex: true,
1152-
canUseTombstones: canUseTombstones,
1153-
tombstoneIndexOrdinal: idx.Ordinal(),
1148+
name: idx.GetName(),
1149+
table: ot.ID(),
1150+
columns: idx.IndexDesc().KeyColumnIDs[idx.IndexDesc().ExplicitColumnStartIdx():],
1151+
withoutIndex: true,
1152+
canUseTombstones: canUseTombstones,
1153+
// One would assume that this would be idx.Ordinal(), but they can differ during schema change
1154+
tombstoneIndexOrdinal: i,
11541155
predicate: idx.GetPredicate(),
11551156
// TODO(rytaft): will we ever support an unvalidated unique constraint
11561157
// here?

0 commit comments

Comments
 (0)