[MDEV-25075] Ignorable index makes the resulting CREATE TABLE invalid Created: 2021-03-07  Updated: 2021-03-23  Resolved: 2021-03-17

Status: Closed
Project: MariaDB Server
Component/s: Optimizer, Parser
Affects Version/s: 10.6
Fix Version/s: 10.6.0

Type: Bug Priority: Blocker
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-7317 Make an index ignorable to the optimizer Closed
Relates

 Description   

The syntax for creating an ignorable index, according to MDEV_7317, is KEY .. IGNORE. However, the resulting SHOW CREATE TABLE shows "IGNORED" instead, and an attempt to use it causes a syntax error:

10.6 03ff588d1

MariaDB [test]> CREATE TABLE t (a INT, KEY (a) IGNORE);
Query OK, 0 rows affected (0.046 sec)
 
MariaDB [test]> SHOW CREATE TABLE t;
+-------+---------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                  |
+-------+---------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` int(11) DEFAULT NULL,
  KEY `a` (`a`) IGNORED
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+---------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)

MariaDB [test]> DROP TABLE t;
Query OK, 0 rows affected (0.031 sec)
 
MariaDB [test]> CREATE TABLE `t` (
    ->   `a` int(11) DEFAULT NULL,
    ->   KEY `a` (`a`) IGNORED
    -> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ENGINE=InnoDB DEFAULT CHARSET=latin1' at line 4



 Comments   
Comment by Elena Stepanova [ 2021-03-07 ]

Also, since the new ALTER INDEX sub-command took a form ALTER INDEX <name> <attribute>, it's better to make it consistent with CREATE TABLE and SHOW CREATE TABLE and use IGNORED in all of them, it's the more natural variant:

  • CREATE TABLE t (a INT, KEY(a) IGNORED)
  • ALTER TABLE t ALTER INDEX a NOT IGNORED
  • ALTER TABLE t ALTER INDEX a IGNORED
Comment by Varun Gupta (Inactive) [ 2021-03-07 ]

Yes blunder on my part, I just made the change in the output of SHOW CREATE TABLE but forgot the other cases.
Have made a minor fix to the parser. Pushed the fix to a staging branch
http://buildbot.askmonty.org/buildbot/grid?category=main&branch=bb-10.6-mdev7317

Comment by Sergei Petrunia [ 2021-03-16 ]

... Fails in the BB. Adjusted patch:
https://github.com/mariadb/server/tree/bb-10.6-mdev25075
http://buildbot.askmonty.org/buildbot/grid?category=main&branch=bb-10.6-mdev25075

Comment by Sergei Petrunia [ 2021-03-16 ]

Also, taking care about MDEV-25078 with this

Generated at Thu Feb 08 09:34:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.