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

the PRIMARY KEY attribute for a field does not accept TYPE to chose the index type

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • Parser
    • None

    Description

      This statement

      CREATE TABLE t1 (
        c1 INT PRIMARY KEY
      ) ENGINE MEMORY
      

      makes c1 the primary key and uses the default index type (HASH for MEMORY engine).

      If we want to use a BTREE index instead, then this does not work:

      CREATE TABLE t1 (
        c1 INT PRIMARY KEY TYPE BTREE
      ) ENGINE MEMORY
      

      the SQL parser bails out at 'TYPE BTREE'

      If written like so, it works again:

      CREATE TABLE t1 (
        c1 INT,
        PRIMARY KEY (c1) TYPE BTREE
      ) ENGINE MEMORY
      

      The request is to extend the parser to accept an index TYPE when a column definition contains an attribute that would add an index for that column. That is not just PRIMARY KEY, but also UNIQUE.

      Attachments

        Activity

          People

            Unassigned Unassigned
            axel Axel Schwenke
            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.