The Wayback Machine - https://web.archive.org/web/20200912005148/https://github.com/phpmyadmin/sql-parser/issues/296
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export fails to recognize descending index option #296

Open
ncolgrove opened this issue Mar 26, 2020 · 0 comments
Open

Export fails to recognize descending index option #296

ncolgrove opened this issue Mar 26, 2020 · 0 comments
Labels
bug
Milestone

Comments

@ncolgrove
Copy link

@ncolgrove ncolgrove commented Mar 26, 2020

MySQL 8.0 supports Descending Indexes, export doesn't recognize the optional "DESC" key_part during parsing. DESC option creates invalid export. "DESC" flag is parsed as the column name in output. ADD KEY `entries__ug` (`DESC`);

Index can be created with the following:

ALTER TABLE `entries` 
ADD INDEX `entries__ug` (`fk_ug_id` DESC);

MySQL CLI export creates:

CREATE TABLE `entries` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `fk_ug_id` int(11) DEFAULT NULL,
 `amount` decimal(10,2) DEFAULT NULL,
 PRIMARY KEY (`id`),
 KEY `entries__ug` (`fk_ug_id` DESC)
) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=4465 DEFAULT CHARSET=utf8

Export from phpMyAdmin results in the following, which is invalid:

--
-- Indexes for table `entries`
--
ALTER TABLE `entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `entries__ug` (`DESC`);

Statement should look like:

--
-- Indexes for table `entries`
--
ALTER TABLE `entries`
  ADD PRIMARY KEY (`id`),
  ADD KEY `entries__ug` (`fk_ug_id` DESC);
@williamdes williamdes added the bug label Mar 26, 2020
@williamdes williamdes added this to the 4.6.0 milestone Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.