sql-parser
sql-parser copied to clipboard
A validating SQL lexer and parser with a focus on MySQL dialect.
Hello! I know this library is primarily for MySQL dialects, but this is the only PHP SQL parser I could find... This can't parse the 'custom' Postgres dump, but I...
When using ROW_NUMBER and an alias such as : ```sql SELECT ROW_NUMBER() OVER (ORDER BY `start`) ``` Phpmyadmin is showing an error but the query works. It says "An alias...
```CHECK TABLE `table` FOR UPGRADE;``` will give two errors. 1. Unrecognized keyword. (near FOR) 2. Unrecognized keyword. (near UPGRADE) ```ALTER TABLE `table` FORCE;``` will give one error. 1. Unrecognized alter...
This query, when formatted will give an unexpected token error because there's no space after `LINES`. ```LOAD DATA INFILE 'filename' IGNORE INTO TABLE `db`.`table` FIELDS TERMINATED BY ',' ENCLOSED BY...
There were unnecessary spaced included in the statement when - a clause is removed (replaced with empty string) - the replacement string already has spaces - the replacement was at...
Fixes #556
### Describe the bug This is a valid query, but it fails parsing it. ```SQL KILL 2883486; ``` ### To Reproduce Steps to reproduce the behavior: 1. Go to https://demo.phpmyadmin.net/QA_5_2/index.php?route=/server/sql...
`CHECK` is in Parser::STATEMENT_PARSERS, but also allowed in the column definition. This doesn't enforce an order for the check constraint. It seems to be only allowed at the end of...
Fixes phpmyadmin/phpmyadmin#17190 Replaces _END_OPTIONS with the actual names from here: https://github.com/phpmyadmin/sql-parser/blob/29f982a9559ac9a97b19e58b78a3fa4c41d5e43f/src/Statements/SelectStatement.php#L84-L228