Commit daca12a
fix(mysql): accept quoted charset in
* fix(mysql): accept quoted charset in `USING`.
MySQL allows backtick-quoted charset names in both `CONVERT(... USING)`
and `CHAR(... USING)`. Both called `_parse_var`, which only matches
unquoted tokens. Adding `TokenType.IDENTIFIER` to the token set accepts
quoted charsets without changing behavior for unquoted ones.
* fix(mysql): Support for `CHAR(... USING BINARY)`.
Handle parsing of `SELECT CHAR(65 USING BINARY)`, which is a valid MySQL
character set.
* fix(mysql): preserve quoted charset names.
Charset names requiring quotes (e.g. spaces from custom XML-registered
charsets per https://dev.mysql.com/doc/refman/8.0/en/identifiers.html)
were roundtripping to invalid SQL. For MySQL, these are now retained as
quoted identifiers while safe names still emit bare.
* fix(mysql): Reuse `SAFE_IDENTFIER_RE`.
Reuse `SAFE_IDENTFIER_RE` instead of using a dialect-specific parallel
copy.
* Update sqlglot/parsers/mysql.py
* Update sqlglot/parser.py
---------
Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>USING. (#7522)1 parent 8583c2d commit daca12a
3 files changed
Lines changed: 49 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7599 | 7599 | | |
7600 | 7600 | | |
7601 | 7601 | | |
7602 | | - | |
| 7602 | + | |
7603 | 7603 | | |
7604 | 7604 | | |
7605 | 7605 | | |
| 7606 | + | |
| 7607 | + | |
| 7608 | + | |
| 7609 | + | |
| 7610 | + | |
| 7611 | + | |
| 7612 | + | |
| 7613 | + | |
| 7614 | + | |
7606 | 7615 | | |
7607 | 7616 | | |
7608 | 7617 | | |
| |||
7719 | 7728 | | |
7720 | 7729 | | |
7721 | 7730 | | |
7722 | | - | |
7723 | | - | |
7724 | | - | |
| 7731 | + | |
7725 | 7732 | | |
7726 | 7733 | | |
7727 | 7734 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
486 | 486 | | |
487 | 487 | | |
488 | 488 | | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
489 | 503 | | |
490 | 504 | | |
491 | 505 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
637 | 661 | | |
638 | 662 | | |
639 | 663 | | |
| |||
0 commit comments