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

aut_increment field cannot be use unles it's first field in primary key

    XMLWordPrintable

Details

    Description

      I thought, this was allowed

      CREATE TABLE test (
        day date NOT NULL DEFAULT CURDATE(),
        fileid int(11) UNSIGNED NOT NULL DEFAULT 0,
        lineid int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        PRIMARY KEY (day, fileid, lineid)
      )
      

      the above create table statement fails, and the only one that works is

      CREATE TABLE test (
        day date NOT NULL DEFAULT CURDATE(),
        fileid int(11) UNSIGNED NOT NULL DEFAULT 0,
        lineid int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
        PRIMARY KEY (lineid,day, fileid)
      )
      

      Is there a workaround?
      my version is 10.6.16-MariaDB-1:10.6.16+maria~ubu2004 mariadb.org binary distribution

      Attachments

        Activity

          People

            marko Marko Mäkelä
            philip_38 Philip orleans
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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