Skip to content

Commit beaa411

Browse files
committed
Add queries that are expected to fail to the query corpus
The extractor skipped every query that a MySQL test expects to fail, but most of them parse, because errors like a missing table come after parsing. The corpus grows from 69,370 to 77,319 rows. A query that the tests only ever expect to fail with a syntax error (1064) has "syntax_error" in a third column. The parser should reject these rows, and any other row should parse. A failure is now a row where it does the opposite. ER_SYNTAX_ERROR (1149) isn't marked, because it comes from semantic checks on queries that parse. The pinned failures grow from 43 to 226: - 14 regular rows have a syntax error that MySQL doesn't reach, because a semantic check during parsing reports another error first. - 169 marked rows are accepted by the parser. MySQL 8.4.10 rejects 90 of them with checks in grammar actions and parse tree classes, which this parser doesn't have, and parses the other 79 when they're prepared. The benchmark skips marked rows, because the parser stops early on them.
1 parent 837da1d commit beaa411

6 files changed

Lines changed: 13816 additions & 450 deletions

File tree

‎packages/mysql-parser/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ This requires `bash`, `curl`, `docker`, and `php` and executes the following ste
8080
3. Extract and compact the grammar and tokens, and save them in `src`.
8181

8282
### Building the query corpus
83-
This package includes a testing corpus of about 70,000 MySQL queries extracted
83+
This package includes a testing corpus of about 77,000 MySQL queries extracted
8484
from the MySQL release that corresponds to the generated MySQL grammar version.
8585
To regenerate it, use:
8686

@@ -94,6 +94,8 @@ This requires `bash`, `git`, and `php`. It performs the following steps:
9494
3. Store the queries under `data/mysql-server-query-corpus/mysql-latest.csv`.
9595

9696
A query that runs in SQL modes that affect the lexer has them in a second column.
97+
A query that the MySQL tests only ever expect to fail with a syntax error has
98+
`syntax_error` in a third column.
9799

98100
## Tests and benchmarks
99101
To run lexer and parser tests and benchmarks, use:

0 commit comments

Comments
 (0)