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

    Details

    • Type: Task
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Parser
    • Labels:
      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

            • Assignee:
              bar Alexander Barkov
              Reporter:
              axel Axel Schwenke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: