cockroachdb / cockroachdb/cockroach
sql/schemachanger: ALTER COLUMN TYPE not supported for primary key columns
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
ALTER COLUMN TYPE that requires a rewrite of the on-disk data is not yet
supported when the column is a key column of the table's primary index.
This is split out from cockroachdb/cockroach#47636, which tracked ALTER COLUMN
TYPE for columns that are part of an index. Support for (non-inverted)
secondary index columns has landed in the declarative schema changer; primary
key columns remain unsupported and are tracked here.
Attempting it currently returns:
ALTER COLUMN TYPE requiring rewrite of on-disk data is currently not
supported for columns that are part of the primary key
Code reference:
- [pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_column_type.go](https://github.com/cockroachdb/cockroach/blob/master/pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_column_type.go)
Epic CRDB-44826
Jira issue: CRDB-65860
Contributor guide
Research direction
Start in pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_column_type.go, focusing on the handling of ALTER COLUMN TYPE when rewrite of on-disk data affects a primary-index key column. Compare the existing secondary-index support and trace the current unsupported path. Done means the operation is supported for primary key columns instead of returning the documented error, with relevant coverage identified while exploring the schema changer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100