Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql/schemachanger: Enable column type changes for virtual computed columns #135315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

spilchen
Copy link
Contributor

This update introduces support for altering the column type of virtual computed columns in the declarative schema changer (DSC). Previously, such operations were not allowed.

A key characteristic of virtual columns is that type changes never require a backfill or column rewrite, as their values are computed dynamically during access. This change includes adjustments to handle type changes that would typically involve a rewrite as simple metadata updates instead.

Additionally, the USING expression in ALTER TABLE statements is now explicitly disallowed for virtual columns, as no data rewriting occurs. Attempts to use this option will result in an error.

Epic: CRDB-25314
Closes: #125840
Release note: none

@spilchen spilchen self-assigned this Nov 15, 2024
@spilchen spilchen requested a review from a team as a code owner November 15, 2024 19:14
@cockroach-teamcity
Copy link
Member

This change is Reviewable

…lumns

This update introduces support for altering the column type of virtual
computed columns in the declarative schema changer (DSC). Previously,
such operations were not allowed.

A key characteristic of virtual columns is that type changes never
require a backfill or column rewrite, as their values are computed
dynamically during access. This change includes adjustments to handle
type changes that would typically involve a rewrite as simple metadata
updates instead.

Additionally, the USING expression in ALTER TABLE statements is now
explicitly disallowed for virtual columns, as no data rewriting occurs.
Attempts to use this option will result in an error.

Epic: CRDB-25314
Closes: cockroachdb#125840
Release note: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: ALTER COLUMN TYPE on virtual column fails
2 participants