Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-29206

DEFAULT NULL for NOT NULL columns is not always detected

    XMLWordPrintable

Details

    Description

      Normally DEFAULT NULL is not allowed for NOT NULL columns:

      MariaDB [test]> create table t1 (a int not null default null);
      ERROR 1067 (42000): Invalid default value for 'a'
      MariaDB [test]> create table t1 (a int default null primary key);
      ERROR 1067 (42000): Invalid default value for 'a'
      

      But this error condition is not always detected and sometimes DEFAULT NULL is silently ignored:

      MariaDB [test]> create table t1 (a int default null, primary key (a));
      Query OK, 0 rows affected (0.014 sec)
       
      MariaDB [test]> show create table t1\G
      *************************** 1. row ***************************
             Table: t1
      Create Table: CREATE TABLE `t1` (
        `a` int(11) NOT NULL,
        PRIMARY KEY (`a`)
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1
      1 row in set (0.001 sec)
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.