Skip to content

Bug#121124 Ignore unchanged CHECK columns for online DDL - #723

Open
modasserbillah wants to merge 2 commits into
mysql:trunkfrom
modasserbillah:agent/bug-121124-check-datetime-instant
Open

Bug#121124 Ignore unchanged CHECK columns for online DDL#723
modasserbillah wants to merge 2 commits into
mysql:trunkfrom
modasserbillah:agent/bug-121124-check-datetime-instant

Conversation

@modasserbillah

@modasserbillah modasserbillah commented Aug 19, 2026

Copy link
Copy Markdown

What does this change do?

Only compare a CHECK-referenced column's type when its Create_field represents a column changed by the ALTER. It also adds MTR coverage for both INSTANT and INPLACE ENUM extensions when an unrelated enforced CHECK references DATETIME(6).

Why is it needed?

When any MODIFY COLUMN sets ALTER_CHANGE_COLUMN, the CHECK-constraint evaluation code currently examines unchanged columns too. Item_field reports an unchanged DATETIME(6) as MYSQL_TYPE_DATETIME, while Create_field reports it as MYSQL_TYPE_DATETIME2. MySQL therefore falsely concludes that the checked column changed and requires a table copy for an otherwise metadata-only ENUM extension.

Fixes MySQL Bug #121124.

How was it tested?

  • Added/updated MTR tests under mysql-test/
  • scripts/ci/mtr.sh passes locally
  • Ran the relevant full suite (name it): N/A

git diff --check passes and the changed C++ code was formatted with the repository configuration. A local Debug build was attempted on macOS, but the host's global Homebrew Protobuf 29.1 headers conflict with MySQL's bundled Protobuf 24.4 before the build reaches the changed code. The upstream Linux CI build and MTR run are therefore the authoritative validation.

The initial GitHub build, MTR, and format jobs also fail before checkout because the repository's pull_request_target workflows do not opt in to checking out fork PR code under the current actions/checkout security policy. No PR code is compiled, formatted, or tested in those failed jobs.

Contributor checklist

  • I have signed the OCA with the email on these commits
  • Code is formatted (scripts/ci/format.sh)
  • Commits are focused with descriptive messages

AI assistance

  • I did not use AI assistance for this contribution
  • I used AI assistance for this contribution

OpenAI Codex assisted with root-cause analysis, the code change, regression-test preparation, and this pull request description.

Areas touched

  • SQL-layer ALTER TABLE CHECK-constraint evaluation
  • check_constraints MTR coverage

@oracle-contributor-agreement

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Aug 19, 2026
@github-actions github-actions Bot added Tests Changes touching test code or test data MTR Failed MTR suite failed Build Failed PR build failed labels Aug 19, 2026
@modasserbillah

Copy link
Copy Markdown
Author

I have signed an OCA which is under review. The CI workflows seem to block the checkout step for PRs from forks. @gopshank please let me know if I need to follow a different procedure for filing the PR.

@modasserbillah
modasserbillah marked this pull request as ready for review August 19, 2026 14:07
@modasserbillah
modasserbillah requested a review from a team August 19, 2026 14:07
@gopshank
gopshank requested review from RidhaOracle and removed request for gopshank and seemasundara August 20, 2026 10:13
@gopshank

Copy link
Copy Markdown
Member

I have signed an OCA which is under review. The CI workflows seem to block the checkout step for PRs from forks. @gopshank please let me know if I need to follow a different procedure for filing the PR.

Sure, we shall check and get back.

@oracle-contributor-agreement

Copy link
Copy Markdown

Thank you for signing the OCA.

@oracle-contributor-agreement oracle-contributor-agreement Bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Aug 20, 2026
@github-actions github-actions Bot added the Review Requested Review requested from code owners label Aug 20, 2026
@gopshank
gopshank requested review from phulakun and removed request for RidhaOracle, gopshank and seemasundara August 20, 2026 17:41
@RidhaOracle

RidhaOracle commented Aug 21, 2026

Copy link
Copy Markdown
Member

@modasserbillah Can you rebase your branch on latest trunk to pick up the fixed Github CI/CD actions ?

Problem:
========
A column-definition ALTER checks every column referenced by an enforced
CHECK constraint for type changes. Unchanged DATETIME columns use different
internal type representations in Item_field and Create_field, so an unrelated
instant ENUM extension is incorrectly forced to use COPY.

Solution:
=========
Only compare CHECK-referenced column types for Create_field entries that
represent changed columns. Add MTR coverage for INSTANT and INPLACE ENUM
extensions with an unrelated CHECK on DATETIME(6).

Signed-off-by: Modasser Billah <imtishad@gmail.com>
@modasserbillah
modasserbillah force-pushed the agent/bug-121124-check-datetime-instant branch from 8271e79 to 6f04097 Compare August 21, 2026 09:24
@github-actions github-actions Bot removed Build Failed PR build failed MTR Failed MTR suite failed labels Aug 21, 2026
@modasserbillah

Copy link
Copy Markdown
Author

@RidhaOracle done!

@github-actions github-actions Bot added the Build Passed PR build passed label Aug 21, 2026
@modasserbillah

Copy link
Copy Markdown
Author

The formatting failure lines reported are not part of my PR.

@github-actions github-actions Bot added the MTR Failed MTR suite failed label Aug 21, 2026
@modasserbillah

Copy link
Copy Markdown
Author

Looks like the failures are unrelated @RidhaOracle please let me know if there's something to do on my side.

@modasserbillah

Copy link
Copy Markdown
Author

@RidhaOracle @phulakun just following up in case you want me to make any changes.

Comment thread sql/sql_table.cc
@github-actions github-actions Bot removed Build Passed PR build passed MTR Failed MTR suite failed labels Aug 27, 2026

@phulakun phulakun 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.

Hello @modasserbillah

Thank you for addressing the review comments. Changes look good to me.

Regards,
Praveen

@modasserbillah

Copy link
Copy Markdown
Author

Thanks @phulakun , what's the next step to get this merged? Also, is there a way to ship this to version 8.0.42?

@modasserbillah

Copy link
Copy Markdown
Author

@gopshank @RidhaOracle please guide me to the next steps to get this merged, thanks!

@RidhaOracle

Copy link
Copy Markdown
Member

Triggering the CI/CD pipelines and then will move it to integrate.

@github-actions github-actions Bot added Build Passed PR build passed MTR Passed MTR suite passed labels Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build Passed PR build passed MTR Passed MTR suite passed OCA Verified All contributors have signed the Oracle Contributor Agreement. Review Requested Review requested from code owners Tests Changes touching test code or test data

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants