[MDEV-17707] the PRIMARY KEY attribute for a field does not accept TYPE to chose the index type Created: 2018-11-14  Updated: 2021-05-11

Status: Open
Project: MariaDB Server
Component/s: Parser
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Axel Schwenke Assignee: Unassigned
Resolution: Unresolved Votes: 0
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.


Generated at Thu Feb 08 08:38:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.