cockroachdb / cockroachdb/cockroach

sql/schemachanger: ALTER COLUMN TYPE not supported for columns in inverted indexes

Open
#172,615 0 comments 0 reactions 0 assignees View on GitHub
A-sql-pgcompat C-enhancement O-agent T-sql-foundations
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 part of an inverted 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; inverted indexes
remain unsupported because their special encoding is not yet handled by the
index-rebuild path used for the column swap.

Attempting it currently returns:

ALTER COLUMN TYPE requiring rewrite of on-disk data is currently not
supported for columns that are part of an inverted index

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-65861

Contributor guide

Open the contributing guide

Research direction

Start in pkg/sql/schemachanger/scbuild/internal/scbuildstmt/alter_table_alter_column_type.go and trace the index-rebuild path used for the column swap. Reproduce ALTER COLUMN TYPE on a column in an inverted index, then follow the existing handling for supported index columns. Done means the on-disk rewrite succeeds for inverted-index columns instead of returning the current unsupported error.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.