Skip to content

Conversation

@spilchen
Copy link
Contributor

The RenameColumnInTable helper updated the index descriptors for every index that depended on the renamed column, but it returned after renaming the first hidden shard column. As soon as a table had more than one hash-sharded index using the same key columns, subsequent shard columns kept their old names. This was a problem with the legacy schema changer and DSC.

This commit fixes RenameColumnInTable to iterate over every shard column that needs to be renamed.

Closes #156907
Release note (bug fix): Renaming a column that participates in multiple hash-sharded indexes no longer fails.

The `RenameColumnInTable` helper updated the index descriptors for every
index that depended on the renamed column, but it returned after
renaming the first hidden shard column. As soon as a table had more than
one hash-sharded index using the same key columns, subsequent shard
columns kept their old names. This was a problem with the legacy schema
changer and DSC.

This commit fixes `RenameColumnInTable` to iterate over every shard
column that needs to be renamed.

Closes cockroachdb#156907
Release note (bug fix): Renaming a column that participates in multiple
hash-sharded indexes no longer fails.
@spilchen spilchen self-assigned this Nov 19, 2025
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@spilchen spilchen marked this pull request as ready for review November 19, 2025 18:00
@spilchen spilchen requested a review from a team as a code owner November 19, 2025 18:00
Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spilchen Nice find!

:lgtm_strong:

@fqazi reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @spilchen)

@spilchen
Copy link
Contributor Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Nov 20, 2025

@craig craig bot merged commit 7e8456c into cockroachdb:master Nov 20, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pkg/ccl/testccl/workload/schemachange/schemachange_test.TestWorkload: TestWorkload failed

3 participants