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

innodb_force_primary_key option does not force PK or unique key

    XMLWordPrintable

Details

    Description

      The option only forces a key (any key) on not nullable columns. As I understand from MDEV-5335, it was not the idea.

      MariaDB [test]> set global innodb_force_primary_key = 1;
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> create table t1 (i int not null);
      ERROR 1173 (42000): This table type requires a primary key
      MariaDB [test]> # works
       
      MariaDB [test]> create table t1 (i int not null, key(i));
      Query OK, 0 rows affected (0.61 sec)
       
      MariaDB [test]> # but it's not a primary key or unique key
       
      MariaDB [test]> insert into t1 values (1),(1);
      Query OK, 2 rows affected (0.08 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> show create table t1 \G
      *************************** 1. row ***************************
             Table: t1
      Create Table: CREATE TABLE `t1` (
        `i` int(11) NOT NULL,
        KEY `i` (`i`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      1 row in set (0.00 sec)

      Attachments

        Issue Links

          Activity

            People

              jplindst Jan Lindström (Inactive)
              elenst Elena Stepanova
              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.