Skip to content

Commit af64c68

Browse files
authored
Merge pull request #156135 from cockroachdb/blathers/backport-release-25.3-156105
release-25.3: sql/opt_catalog: Use index offset as tombstone index ordinal
2 parents 6776cba + 168fa73 commit af64c68

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
@@ -1146,12 +1146,13 @@ func newOptTable(
11461146
canUseTombstones := idx.ImplicitPartitioningColumnCount() == 1 &&
11471147
partitionColumn.GetType().Family() == types.EnumFamily
11481148
ot.uniqueConstraints = append(ot.uniqueConstraints, optUniqueConstraint{
1149-
name: idx.GetName(),
1150-
table: ot.ID(),
1151-
columns: idx.IndexDesc().KeyColumnIDs[idx.IndexDesc().ExplicitColumnStartIdx():],
1152-
withoutIndex: true,
1153-
canUseTombstones: canUseTombstones,
1154-
tombstoneIndexOrdinal: idx.Ordinal(),
1149+
name: idx.GetName(),
1150+
table: ot.ID(),
1151+
columns: idx.IndexDesc().KeyColumnIDs[idx.IndexDesc().ExplicitColumnStartIdx():],
1152+
withoutIndex: true,
1153+
canUseTombstones: canUseTombstones,
1154+
// One would assume that this would be idx.Ordinal(), but they can differ during schema change
1155+
tombstoneIndexOrdinal: i,
11551156
predicate: idx.GetPredicate(),
11561157
// TODO(rytaft): will we ever support an unvalidated unique constraint
11571158
// here?

0 commit comments

Comments
 (0)