Skip to content

sql-statements: document ALTER TABLE COMPRESSION='NONE' behavior#23299

Open
takaidohigasi wants to merge 3 commits into
pingcap:masterfrom
takaidohigasi:tidb_62229_alter_table_compression_none
Open

sql-statements: document ALTER TABLE COMPRESSION='NONE' behavior#23299
takaidohigasi wants to merge 3 commits into
pingcap:masterfrom
takaidohigasi:tidb_62229_alter_table_compression_none

Conversation

@takaidohigasi

@takaidohigasi takaidohigasi commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What is changed, added or deleted? (Required)

Document the ALTER TABLE ... COMPRESSION behavior introduced by pingcap/tidb#62305:

  • ALTER TABLE ... COMPRESSION only accepts 'NONE' (case-insensitive) and it is a no-op (metadata-only; TiDB does not compress or uncompress any table data). This allows reverting the COMPRESSION attribute for tables migrated from MySQL.
  • Other values such as 'ZLIB' and 'LZ4' return the error This type of ALTER TABLE is currently unsupported (error code 8200).
  • If an unsupported COMPRESSION value is specified together with other options in one statement, none of the options take effect.

Added one item to the MySQL compatibility section of sql-statements/sql-statement-alter-table.md.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

Summary by CodeRabbit

  • Documentation
    • Updated ALTER TABLE MySQL compatibility guidance for the COMPRESSION option.
    • Clarified that only 'NONE' is accepted and treated as a no-op; other values return an unsupported-operation error.
    • Documented that unsupported compression values prevent other options in the same statement from taking effect.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ti-chi-bot ti-chi-bot Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. contribution This PR is from a community contributor. labels Jul 16, 2026
@ti-chi-bot

ti-chi-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

Hi @takaidohigasi. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot Bot added needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. missing-translation-status This PR does not have translation status info. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jul 16, 2026
@takaidohigasi
takaidohigasi marked this pull request as ready for review July 16, 2026 10:46
@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 16, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the ALTER TABLE documentation to clarify that the COMPRESSION option only accepts NONE as a no-op for compatibility, while other values like ZLIB or LZ4 will return an error. The review feedback suggests formatting SQL values with backticks, using active voice, and addressing the user in the second person to align with the repository style guide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread sql-statements/sql-statement-alter-table.md Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@qiancai
qiancai requested a review from D3Hunter July 17, 2026 07:03
@qiancai qiancai self-assigned this Jul 17, 2026
@qiancai qiancai added v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3. translation/doing This PR's assignee is translating this PR. labels Jul 17, 2026
@ti-chi-bot ti-chi-bot Bot removed the missing-translation-status This PR does not have translation status info. label Jul 17, 2026
@qiancai

qiancai commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

@D3Hunter Please help with the tech review of this PR. Thanks.


- `ALTER TABLE t CACHE | NOCACHE` is a TiDB extension to MySQL syntax. For details, see [Cached Tables](/cached-tables.md).

- `ALTER TABLE ... COMPRESSION` only accepts `NONE` (case-insensitive) and is a no-op. TiDB accepts this statement only for compatibility (for example, for tables migrated from MySQL that carry a `COMPRESSION` attribute) and does not compress or uncompress any table data. Specifying other values, such as `ZLIB` or `LZ4`, returns the error `This type of ALTER TABLE is currently unsupported` (error code 8200). If you specify an unsupported `COMPRESSION` value together with other options in a single statement, none of the options take effect.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The parser grammar requires COMPRESSION to be followed by stringLit, so bare NONE, ZLIB, and LZ4 do not reflect executable syntax. Keeping the quotes inside the code span also makes the MySQL-migration example immediately usable.

Suggested change
- `ALTER TABLE ... COMPRESSION` only accepts `NONE` (case-insensitive) and is a no-op. TiDB accepts this statement only for compatibility (for example, for tables migrated from MySQL that carry a `COMPRESSION` attribute) and does not compress or uncompress any table data. Specifying other values, such as `ZLIB` or `LZ4`, returns the error `This type of ALTER TABLE is currently unsupported` (error code 8200). If you specify an unsupported `COMPRESSION` value together with other options in a single statement, none of the options take effect.
- `ALTER TABLE ... COMPRESSION` accepts only the string literal `'NONE'` (case-insensitive) and is a no-op. TiDB accepts this statement only for compatibility, for example, for tables migrated from MySQL that carry a `COMPRESSION` attribute. It does not compress or uncompress table data. Other values, such as `'ZLIB'` or `'LZ4'`, return error code 8200 (`This type of ALTER TABLE is currently unsupported`). If you specify an unsupported `COMPRESSION` value together with other options in a single statement, none of the options take effect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Applied your suggestion in 375da90 — thanks for catching that the grammar requires a string literal after COMPRESSION.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ti-chi-bot

ti-chi-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from qiancai. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4c69f61a-d86d-49c2-b6a4-0285f8979e51

📥 Commits

Reviewing files that changed from the base of the PR and between 9b6f832 and 375da90.

📒 Files selected for processing (1)
  • sql-statements/sql-statement-alter-table.md

📝 Walkthrough

Walkthrough

The ALTER TABLE MySQL compatibility restrictions now document COMPRESSION behavior: 'NONE' is accepted as a no-op, unsupported values return error 8200, and combined statements apply none of their other options.

Changes

ALTER TABLE compatibility

Layer / File(s) Summary
Document COMPRESSION restrictions
sql-statements/sql-statement-alter-table.md
Documents accepted 'NONE', unsupported compression values, error 8200, and the behavior of combined ALTER TABLE options.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: d3hunter

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the documentation update about ALTER TABLE COMPRESSION='NONE'.
Description check ✅ Passed The description includes the required change summary, affected version, reference link, and AI involvement section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. translation/doing This PR's assignee is translating this PR. v9.0-beta.3 This PR/issue applies to TiDB v9.0-beta.3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants