[MDEV-5848] MySQL bug#11747847 - 34280: create table fails if NO_ZERO_DATE or NO_ZERO_IN_DATE SQL mode is set Created: 2014-03-13  Updated: 2014-03-21  Resolved: 2014-03-21

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.9
Fix Version/s: 10.0.11

Type: Bug Priority: Major
Reporter: Sergey Vojtovich Assignee: Sergei Golubchik
Resolution: Won't Fix Votes: 0
Labels: None

Attachments: Text File bug11747847.patch    
Issue Links:
PartOf
is part of MDEV-4784 merge test cases from 5.6 Stalled

 Description   

Test case for MySQL "bug#11747847 - 34280: create table fails if NO_ZERO_DATE or NO_ZERO_IN_DATE SQL mode is set" fails in 10.0.

Test diff attached. Please try to apply test case as is unless it is applicable.



 Comments   
Comment by Sergei Golubchik [ 2014-03-21 ]

I'm not sure we need to fix it. Current behavior is consistent — everything that causes a truncation warning during INSERT is rejected as a default value on CREATE. Compare:

  1. SET SQL_MODE=NO_ZERO_DATE; INSERT t1 (timestamp_column) VALUES (0);
  2. SET SQL_MODE=NO_ZERO_DATE; CREATE TABLE t2 (a TIMESTAMP 0);
  3. INSERT t3 (tinyint_column) VALUES (1000)
  4. CREATE TABLE t4 (a TINYINT 1000);

Both 1 and 3 will issue a truncation warning. Both 2 and 4 will fail. This is consistent.
After Oracle's fix for MySQL bug #11747847 - 34280, the 2 won't fail. But 4 still will.
This is inconsistent.

I'd prefer to leave it as is, or to fix both 2 and 4 not to fail, a.k.a. use the same logic in INSERT and CREATE.

Generated at Thu Feb 08 07:07:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.