diff --git a/pegjs/mariadb.pegjs b/pegjs/mariadb.pegjs index c3901de7..5d2339fd 100644 --- a/pegjs/mariadb.pegjs +++ b/pegjs/mariadb.pegjs @@ -1551,7 +1551,7 @@ show_stmt } } } - / KW_SHOW __ keyword:('COLUMNS'i / 'INDEXES'i) __ from:from_clause { + / KW_SHOW __ keyword:('COLUMNS'i / 'INDEXES'i / "INDEX"i) __ from:from_clause { return { tableList: Array.from(tableList), columnList: columnListTableAlias(columnList), diff --git a/pegjs/mysql.pegjs b/pegjs/mysql.pegjs index 3c1d10fd..18302300 100644 --- a/pegjs/mysql.pegjs +++ b/pegjs/mysql.pegjs @@ -1840,7 +1840,7 @@ show_stmt } } } - / KW_SHOW __ keyword:('COLUMNS'i / 'INDEXES'i) __ from:from_clause { + / KW_SHOW __ keyword:('COLUMNS'i / 'INDEXES'i / "INDEX"i) __ from:from_clause { return { tableList: Array.from(tableList), columnList: columnListTableAlias(columnList), diff --git a/src/show.js b/src/show.js index 7f82cae2..92a1086b 100644 --- a/src/show.js +++ b/src/show.js @@ -43,6 +43,7 @@ function showToSQL(showExpr) { break case 'COLUMNS': case 'INDEXES': + case 'INDEX': str = commonOptionConnector('FROM', tablesToSQL, showExpr.from) break case 'GRANTS': diff --git a/test/mysql-mariadb.spec.js b/test/mysql-mariadb.spec.js index 11e289a3..0998e7d3 100644 --- a/test/mysql-mariadb.spec.js +++ b/test/mysql-mariadb.spec.js @@ -935,6 +935,13 @@ describe('mysql', () => { ');', "CREATE TABLE `table` (`name` VARCHAR(255) CHECK (`name` LIKE 'ABC%' AND LENGTH(`name`) >= 5))" ] + }, + { + title: 'show index', + sql: [ + 'show index from user', + 'SHOW INDEX FROM `user`' + ] } ] SQL_LIST.forEach(sqlInfo => {