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

Automatic invisible primary key

    XMLWordPrintable

    Details

      Description

      Feature request - new option innodb_automatic_pk (default off, global/session)

      During CREATE TABLE for InnoDB, automatically translate

      – FROM:

      CREATE TABLE t1 (c2 INT) ENGINE=InnoDB;
      

      – TO:

      CREATE TABLE t1 (_inv_PK SERIAL INVISIBLE PRIMARY KEY, c2 INT) ENGINE=InnoDB;
      

      – FROM:

      ALTER TABLE t1 ADD PRIMARY KEY (`c2`);
      

      – TO:

      ALTER TABLE t1 DROP COLUMN IF EXISTS _inv_PK, ADD PRIMARY KEY (`c2`);
      

      It might be a good idea to modify or suppress warning "Can't DROP COLUMN `_inv_PK`" and to issue a warning that _inv_PK was created.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              mg MG
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:

                  Git Integration