Skip to content

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

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

modasserbillah wants to merge 3 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 ?

@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
modasserbillah force-pushed the agent/bug-121124-check-datetime-instant branch from f58daa0 to 6682c32 Compare September 3, 2026 12:40
@github-actions github-actions Bot added Build Passed PR build passed MTR Failed MTR suite failed and removed Build Passed PR build passed MTR Passed MTR suite passed labels Sep 3, 2026
@modasserbillah

Copy link
Copy Markdown
Author

@phulakun @RidhaOracle can you guide me on this please? How can we get this merged? Seems like some checks are failing on unrelated stuff.

@henrikingo-oracle

Copy link
Copy Markdown
Contributor

The unrelated failures should have been fixed in trunk, which means if you can rebase your work onto the most recent trunk, then tests should pass.

@modasserbillah

Copy link
Copy Markdown
Author

@henrikingo-oracle I think this branch is already on top of the most recent trunk after my rebase last week. The trunk hasn't moved since then. Do you have reasons to believe otherwise?

@modasserbillah

Copy link
Copy Markdown
Author

@henrikingo-oracle if you or someone from Oracle could help me fix these failures that'd be great. These aren't related to the changes in the PR and I'm not sure how I can move this forward 🙏🏽

@henrikingo-oracle

Copy link
Copy Markdown
Contributor

Hi @modasserbillah

Yes I or someone can help :-)

I have to apologise for the mess while we are nearing normal GitHub development workflow in a couple months... But it seems there were some fixes pushed to trunk yesterday, which I think are the ones that should be of help to you as well. Can you please rebase once more and then we can see if MTR gets any greener. Again, I really apologize for the trouble here. I thought MTR fixes were pushed already earlier.

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 6682c32 to 706e318 Compare September 14, 2026 10:53
@github-actions github-actions Bot removed Build Passed PR build passed MTR Failed MTR suite failed labels Sep 14, 2026
@modasserbillah

Copy link
Copy Markdown
Author

Thanks for helping me out @henrikingo-oracle ! I have rebased it, let's see how it goes this time 🤞🏽

@henrikingo-oracle

Copy link
Copy Markdown
Contributor

Ok nice, it looks like the MTR tests are indeed fixed or disabled... Is it possible the format check failure is in code you edited? At least the file is part of your patch?

@modasserbillah

Copy link
Copy Markdown
Author

The format checks are part of the files I touched but not related to my changes. Do you want me to try to fix that in this PR @henrikingo-oracle?

@github-actions github-actions Bot added the MTR Passed MTR suite passed label Sep 14, 2026
@henrikingo-oracle

Copy link
Copy Markdown
Contributor

Yeah it looked like the line nr doesn't match with your patch... But I also don't see other PRs having this failure, so maybe you better look into it and see if you get this PR green :-)

@ogrovlen

Copy link
Copy Markdown
Contributor

Yeah it looked like the line nr doesn't match with your patch... But I also don't see other PRs having this failure, so maybe you better look into it and see if you get this PR green :-)

My understanding is that we are here using a different version of clang-format than have been used before, so we may get errors for existing code. The changes to this PR are later in the file than the code that is flagged, so it is very unlikely that it is caused by this PR. That other PRs do not have this failures, is probably because they do not touch sql_table.cc

@github-actions github-actions Bot removed Build Passed PR build passed MTR Passed MTR suite passed labels Sep 15, 2026
@modasserbillah

Copy link
Copy Markdown
Author

Looks like the issue was with semicolons on their own lines, I added a small formatting fix.

@github-actions github-actions Bot added Build Passed PR build passed MTR Passed MTR suite passed labels Sep 15, 2026
@modasserbillah

Copy link
Copy Markdown
Author

@henrikingo-oracle all green but merging seems to be still blocked 🤔

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.

6 participants