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

workload: Add DRT operation for ALTER COLUMN TYPE #141712

Open
spilchen opened this issue Feb 19, 2025 · 0 comments
Open

workload: Add DRT operation for ALTER COLUMN TYPE #141712

spilchen opened this issue Feb 19, 2025 · 0 comments
Assignees
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@spilchen
Copy link
Contributor

spilchen commented Feb 19, 2025

We want to add a new DRT operation to stress-test ALTER COLUMN TYPE. The key requirement for this operation is to avoid modifying existing column types, as that could disrupt ongoing queries. Instead, we will select a column from a table, clone it using ADD COLUMN, and then alter the type of the cloned column. By using an existing column as a reference, we ensure the cloned column contains meaningful data rather than just a single default value.

Steps for the operation:

  1. Select a random table.
  2. Add a new column (the "cloned column") to the table with a BOOL type and a NULL default value.
  3. Select a random column from the table.
  4. Alter the type of the cloned column to match the selected column's type, using the USING expression to copy its contents.
  5. Alter the cloned column's type again, this time using a change that doesn’t require a rewrite. Example mappings:
    INTX -> INTY
    TEXT -> VARCHAR(N)
    VARCHAR(N) -> TEXT
  6. Pause for a while to allow other operations to interact with the column.
  7. Drop the cloned column.

Jira issue: CRDB-47971

@spilchen spilchen added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Feb 19, 2025
@spilchen spilchen self-assigned this Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

No branches or pull requests

1 participant