[MDEV-11967] Spurious "Field doesn't have a default value" warning Created: 2017-02-01  Updated: 2017-02-02  Resolved: 2017-02-02

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.2.2
Fix Version/s: 10.2.3

Type: Bug Priority: Major
Reporter: Guillaume Lefranc Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None


 Description   

CREATE TABLE `facebook_friendship` (
 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
 `facebook_user_id_from` char(36) NOT NULL,
 `user_id_from` char(36) NOT NULL,
 `facebook_user_id_to` char(36) NOT NULL,
 `user_id_to` char(36) NOT NULL,
 `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY (`id`),
 UNIQUE KEY `user_id_uq` (`facebook_user_id_from`,`facebook_user_id_to`)
);

MariaDB [test]> insert into `facebook_friendship` (`facebook_user_id_from`,`user_id_from`,`facebook_user_id_to`,`user_id_to`)  values ('walter', 'walter2', 'walter3', 'walte4r');
Query OK, 1 row affected, 1 warning (0.01 sec)
 
MariaDB [test]> show warnings;
+---------+------+-------------------------------------------------+
| Level   | Code | Message                                         |
+---------+------+-------------------------------------------------+
| Warning | 1364 | Field 'created_at' doesn't have a default value |
+---------+------+-------------------------------------------------+

Default value is still inserted correctly, I guess that's a parser issue.



 Comments   
Comment by Elena Stepanova [ 2017-02-02 ]

It was fixed in 10.2.3. The problem disappeared after this commit:

commit a411d7f4f670c24b43b50f7d2a1129e10218f4a7
Author: Sergei Golubchik <serg@mariadb.org>
Date:   Mon Nov 7 17:17:40 2016 +0100
 
    store/show vcols as item->print()
    
    otherwise we'd need to store sql_mode *per vcol*
    (consider CREATE INDEX...) and how SHOW CREATE TABLE would
    support that?
    
    Additionally, get rid of vcol::expr_str, just to make sure
    the string is always generated and never leaked in the
    original form.

Comment by Guillaume Lefranc [ 2017-02-02 ]

Thanks. Didn't catch this fix despite reading the changelogs.

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