sql-lint icon indicating copy to clipboard operation
sql-lint copied to clipboard

Unable to categorise query for sql keyword GRANT

Open deeagle opened this issue 5 years ago • 2 comments

It seems that sql-lint is unable to parse GRANT keyword.

Query

GRANT SELECT ON myschema.* TO 'username'@'%';

Error

/node_modules/sql-lint/dist/src/lexer/lexer.js:14
    throw new Error(`Unable to categorise query: ${query}. The query must start with one of ${Object.keys(keywords_1.Keyword)}`);
    ^
Error: Unable to categorise query: grant select on myschema.* to 'username'@'%';. The query must start with one of Alter,Begin,Call,Create,Declare,Delete,Delimiter,Drop,Else,End,From,Having,If,Insert,Join,Leave,Limit,Replace,Return,Select,Set,Show,Truncate,Update,Use,Where,CommentHash,CommentDash,CommentMultiLineStart,CommentMultiLineEnd,Newline,WindowsNewline
    at Object.categorise (/node_modules/sql-lint/dist/src/lexer/lexer.js:14:11)
    at /node_modules/sql-lint/dist/src/checker/checkerRunner.js:38:42
    at Array.forEach (<anonymous>)
    at CheckerRunner.run (/node_modules/sql-lint/dist/src/checker/checkerRunner.js:35:20)
    at Object.<anonymous> (/node_modules/sql-lint/dist/src/main.js:86:8)
    at Module._compile (internal/modules/cjs/loader.js:1201:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)
    at Module.load (internal/modules/cjs/loader.js:1050:32)
    at Function.Module._load (internal/modules/cjs/loader.js:938:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)]

Environment

  • github/super-linter within Gitlab
  • lang: MySQL 5.7

deeagle avatar Oct 19 '20 13:10 deeagle

Please, add word grant

zorion79 avatar Nov 26 '20 20:11 zorion79

Hi all, sorry for the delay, this is in the pipeline for the next release. I've done a big refactor so it can better handle different database systems, thanks for the patience!

joereynolds avatar Mar 20 '21 13:03 joereynolds