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

table: Don't cast date default values (same as timestamp/datetime) | tidb-test=pr/2472 #59049

Merged
merged 2 commits into from
Jan 21, 2025

Conversation

mjonss
Copy link
Contributor

@mjonss mjonss commented Jan 20, 2025

What problem does this PR solve?

Issue Number: close #59047

Problem Summary:
During the executor build phase getColDefaultValue is called for the date column and fails, due to trying to cast the default value '0000-00-00' which fails due to default sql_mode.

The underlying issue seems to be that CREATE TABLE does not set column.OriginDefaultValue, while ALTER TABLE ADD COLUMN does, which is ignored in this PR.

What changed and how does it work?

Do as DATETIME and TIMESTAMP, skip cast.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Fix UPDATE after ALTER ADD date column giving error for incorrect value '0000-00-00'.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/cherry-pick-not-approved size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 20, 2025
Copy link

tiprow bot commented Jan 20, 2025

Hi @mjonss. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@mjonss mjonss mentioned this pull request Jan 20, 2025
13 tasks
@dveeden dveeden self-requested a review January 20, 2025 21:23
@YangKeao YangKeao self-requested a review January 21, 2025 05:10
@YangKeao
Copy link
Member

/check-issue-triage-complete

@YangKeao YangKeao changed the title table: Don't cast date default values (same as timestamp/datetime) table: Don't cast date default values (same as timestamp/datetime) | tidb-test=pr/2472 Jan 21, 2025
@YangKeao
Copy link
Member

I've updated the mysql-test result in https://github.com/PingCAP-QE/tidb-test/pull/2472.

@YangKeao
Copy link
Member

/retest

Copy link

codecov bot commented Jan 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (release-6.5@49d7761). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-6.5     #59049   +/-   ##
================================================
  Coverage               ?   73.6212%           
================================================
  Files                  ?       1097           
  Lines                  ?     353049           
  Branches               ?          0           
================================================
  Hits                   ?     259919           
  Misses                 ?      76398           
  Partials               ?      16732           

Copy link

ti-chi-bot bot commented Jan 21, 2025

@mjonss: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-br-integration-test c91b177 link false /test pull-br-integration-test

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@dveeden
Copy link
Contributor

dveeden commented Jan 21, 2025

/check-issue-triage-complete

Copy link
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Jan 21, 2025
@hawkingrei
Copy link
Member

/check-issue-triage-complete

1 similar comment
@purelind
Copy link
Contributor

/check-issue-triage-complete

@purelind
Copy link
Contributor

/retest

Copy link

tiprow bot commented Jan 21, 2025

@purelind: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@wuhuizuo
Copy link
Contributor

/run-check-issue-triage-complete

Copy link

ti-chi-bot bot commented Jan 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dveeden, YangKeao

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

The pull request process is described here

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

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 21, 2025
Copy link

ti-chi-bot bot commented Jan 21, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-21 06:45:37.462360775 +0000 UTC m=+163264.793280179: ☑️ agreed by YangKeao.
  • 2025-01-21 07:13:39.16620622 +0000 UTC m=+164946.497125624: ☑️ agreed by dveeden.

@ti-chi-bot ti-chi-bot bot merged commit d6c07c4 into pingcap:release-6.5 Jan 21, 2025
10 checks passed
@mjonss mjonss deleted the fix-6.5-59047 branch January 21, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants