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

FR: In addition to MDEV-8605 I propose check duplication for PK and unique index before NULL checking

    XMLWordPrintable

Details

    Description

      In addition to MDEV-8605 I propose check duplication for PK and unique index before NULL checking.

      This example should work:

      CREATE TABLE `test` (
        `id_profile` VARBINARY(36) NOT NULL,
        `id_profile_type` INT(10) UNSIGNED NOT NULL,
        `dynamic_cols` BLOB,
        PRIMARY KEY (`id_profile`)
      ) ENGINE=INNODB DEFAULT CHARSET=utf8
       
      INSERT INTO `test` (`id_profile`,`id_profile_type`)  VALUES
      ('f9854cb9-aacb-11e5-98e4-0050563c3a6d', 1),
      ('00a65240-aacc-11e5-98e4-0050563c3a6d', 2),
      ('0a843922-aacc-11e5-98e4-0050563c3a6d', 1);
       
      INSERT INTO `test` (`id_profile`,`dynamic_cols`)  VALUES
      ('f9854cb9-aacb-11e5-98e4-0050563c3a6d', COLUMN_CREATE('sum',100)),
      ('00a65240-aacc-11e5-98e4-0050563c3a6d', COLUMN_CREATE('sum',100)),
      ('0a843922-aacc-11e5-98e4-0050563c3a6d', COLUMN_CREATE('sum',100))
      ON DUPLICATE KEY UPDATE
      `dynamic_cols` = VALUES(`dynamic_cols`);
       
      SELECT id_profile, id_profile_type, COLUMN_JSON(dynamic_cols) FROM test

      But currently having error:
      Error Code: 1364
      Field 'id_profile_type' doesn't have a default value

      Attachments

        Activity

          People

            Unassigned Unassigned
            mikhail Mikhail Gavrilov
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.