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

expected invalid default value for date default '2020-00-00' #26766

Closed
ChenPeng2013 opened this issue Jul 31, 2021 · 3 comments · Fixed by #26828
Closed

expected invalid default value for date default '2020-00-00' #26766

ChenPeng2013 opened this issue Jul 31, 2021 · 3 comments · Fixed by #26828
Assignees
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. fixes-5.1.3 This bug is fixed at 5.1.3 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@ChenPeng2013
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

use test;
drop table if exists t3;
set @@sql_mode='NO_ZERO_IN_DATE,STRICT_ALL_TABLES';
create table t3 (a date default '2020-00-00') partition by range (DAY(a)) (
    partition p0 values less than (10),
    partition p1 values less than (20),
    partition p2 values less than (32)
);

2. What did you expect to see? (Required)

v4.0.12 & release-5.0 & mysql 8.0.21

mysql> set @@sql_mode='NO_ZERO_IN_DATE,STRICT_ALL_TABLES';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> create table t3 (a date default '2020-00-00') partition by range (DAY(a)) (
    ->     partition p0 values less than (10),
    ->     partition p1 values less than (20),
    ->     partition p2 values less than (32)
    -> );
ERROR 1067 (42000): Invalid default value for 'a'

3. What did you see instead (Required)

release-4.0 & release-5.1 & master

mysql> set @@sql_mode='NO_ZERO_IN_DATE,STRICT_ALL_TABLES';
Query OK, 0 rows affected (0.00 sec)

mysql> create table t3 (a date default '2020-00-00') partition by range (DAY(a)) (
    ->     partition p0 values less than (10),
    ->     partition p1 values less than (20),
    ->     partition p2 values less than (32)
    -> );
Query OK, 0 rows affected (0.01 sec)

4. What is your TiDB version? (Required)

Release Version: v5.1.1
Edition: Community
Git Commit Hash: 797bddd25310ed42f0791c8eccb78be8cce2f502
Git Branch: release-5.1
UTC Build Time: 2021-07-31 02:01:43
GoVersion: go1.16.5
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@ChenPeng2013 ChenPeng2013 added type/bug The issue is confirmed as a bug. sig/sql-infra SIG: SQL Infra severity/critical labels Jul 31, 2021
@bb7133
Copy link
Member

bb7133 commented Aug 1, 2021

Hi @ChenPeng2013 thanks for reporting it. However, I don't think it's a critical bug since no corruption is made.

@bb7133
Copy link
Member

bb7133 commented Aug 1, 2021

This bug is introduced by #24174, PTAL @tangenta

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. fixes-5.1.3 This bug is fixed at 5.1.3 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants