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

Problems with EMPTY_STRING_IS_NULL and I_S tables

    XMLWordPrintable

Details

    Description

      INFORMATION_SCHEMA tables add DEFAULT clause for all columns.

      SET SQL_MODE= 'EMPTY_STRING_IS_NULL';
      SHOW CREATE TABLE INFORMATION_SCHEMA.TABLES;
      

      +--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table  | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
      +--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | TABLES | CREATE TEMPORARY TABLE `TABLES` (
        `TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '',
        `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
        `TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
        `TABLE_TYPE` varchar(64) NOT NULL DEFAULT '',
        `ENGINE` varchar(64) DEFAULT NULL,
        `VERSION` bigint(21) unsigned DEFAULT NULL,
        `ROW_FORMAT` varchar(10) DEFAULT NULL,
        `TABLE_ROWS` bigint(21) unsigned DEFAULT NULL,
        `AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL,
        `DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
        `MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
        `INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL,
        `DATA_FREE` bigint(21) unsigned DEFAULT NULL,
        `AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL,
        `CREATE_TIME` datetime DEFAULT NULL,
        `UPDATE_TIME` datetime DEFAULT NULL,
        `CHECK_TIME` datetime DEFAULT NULL,
        `TABLE_COLLATION` varchar(32) DEFAULT NULL,
        `CHECKSUM` bigint(21) unsigned DEFAULT NULL,
        `CREATE_OPTIONS` varchar(2048) DEFAULT NULL,
        `TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT '',
        `MAX_INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL,
        `TEMPORARY` varchar(1) DEFAULT NULL
      ) ENGINE=MEMORY DEFAULT CHARSET=utf8 |
      +--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      

      This does not work well in combination with EMPTY_STRING_IS_NULL.

      If I copy a table definition and try to create it in another database, I get an error:

      SET SQL_MODE= 'EMPTY_STRING_IS_NULL';
      CREATE OR REPLACE TABLE t1 (TABLE_CATALOG varchar(512) NOT NULL DEFAULT '');
      

      ERROR 1067 (42000): Invalid default value for 'TABLE_CATALOG'
      

      I_S tables should probably not add DEFAULT clauses into columns.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.