forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit83f1c7b
committed
Fix ECPG's handling of type names that match SQL keywords.
Previously, ECPG could only cope with variable declarations whosetype names either weren't any SQL keyword, or were at least partiallyreserved. If you tried to use something in the unreserved_keywordcategory, you got a syntax error.This is pretty awful, not only because it says right on the tin thatthose words are not reserved, but because the set of such keywordstends to grow over time. Thus, an ECPG program that was just finelast year could fail when recompiled with a newer SQL grammar.We had to work around this recently when STRING became a keyword,but it's time for an actual fix instead of a band-aid.To fix, borrow a trick from C parsers and make the lexer's behaviorchange when it sees a word that is known as a typedef. This is notfree of downsides: if you try to use such a name as a SQL keywordin EXEC SQL later in the program, it won't be recognized as a SQLkeyword, leading to a syntax error there instead. So in a realsense this is just trading one hazard for another. But there is animportant difference: with this, whether your ECPG program worksdepends only on what typedef names and SQL commands are used in theprogram text. If it compiles today it'll still compile next year,even if more words have become SQL keywords.Discussion:https://postgr.es/m/3661437.1653855582@sss.pgh.pa.us1 parente64cdab commit83f1c7b
File tree
9 files changed
+236
-106
lines changed- doc/src/sgml
- src/interfaces/ecpg
- preproc
- test
- expected
- preproc
9 files changed
+236
-106
lines changedLines changed: 38 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1483 | 1483 |
| |
1484 | 1484 |
| |
1485 | 1485 |
| |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
1486 | 1490 |
| |
1487 | 1491 |
| |
1488 | 1492 |
| |
| |||
1497 | 1501 |
| |
1498 | 1502 |
| |
1499 | 1503 |
| |
1500 |
| - | |
| 1504 | + | |
| 1505 | + | |
1501 | 1506 |
| |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
1502 | 1539 |
| |
1503 | 1540 |
| |
1504 | 1541 |
| |
|
Lines changed: 117 additions & 53 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
564 | 564 |
| |
565 | 565 |
| |
566 | 566 |
| |
567 |
| - | |
| 567 | + | |
568 | 568 |
| |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
569 | 590 |
| |
570 | 591 |
| |
571 | 592 |
| |
| |||
587 | 608 |
| |
588 | 609 |
| |
589 | 610 |
| |
590 |
| - | |
| 611 | + | |
591 | 612 |
| |
592 |
| - | |
593 |
| - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 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 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
594 | 684 |
| |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
595 | 690 |
| |
596 |
| - | |
597 |
| - | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
598 | 699 |
| |
| 700 | + | |
| 701 | + | |
| 702 | + | |
599 | 703 |
| |
600 | 704 |
| |
601 | 705 |
| |
| |||
686 | 790 |
| |
687 | 791 |
| |
688 | 792 |
| |
689 |
| - | |
690 |
| - | |
691 |
| - | |
692 |
| - | |
693 |
| - | |
694 |
| - | |
695 |
| - | |
696 |
| - | |
697 |
| - | |
698 |
| - | |
699 |
| - | |
700 |
| - | |
701 |
| - | |
702 |
| - | |
703 |
| - | |
704 |
| - | |
705 |
| - | |
706 |
| - | |
707 |
| - | |
708 |
| - | |
709 |
| - | |
710 |
| - | |
711 |
| - | |
712 |
| - | |
713 |
| - | |
714 |
| - | |
715 |
| - | |
716 |
| - | |
717 |
| - | |
718 |
| - | |
719 |
| - | |
720 |
| - | |
721 |
| - | |
722 |
| - | |
723 |
| - | |
724 |
| - | |
725 |
| - | |
726 |
| - | |
727 |
| - | |
| 793 | + | |
| 794 | + | |
728 | 795 |
| |
729 | 796 |
| |
730 | 797 |
| |
| |||
751 | 818 |
| |
752 | 819 |
| |
753 | 820 |
| |
754 |
| - | |
| 821 | + | |
755 | 822 |
| |
756 | 823 |
| |
757 | 824 |
| |
| |||
1657 | 1724 |
| |
1658 | 1725 |
| |
1659 | 1726 |
| |
1660 |
| - | |
| 1727 | + | |
1661 | 1728 |
| |
1662 |
| - | |
1663 |
| - | |
1664 |
| - | |
1665 |
| - | |
1666 |
| - | |
1667 |
| - | |
1668 | 1729 |
| |
1669 | 1730 |
| |
| 1731 | + | |
1670 | 1732 |
| |
| 1733 | + | |
| 1734 | + | |
1671 | 1735 |
| |
1672 | 1736 |
| |
1673 | 1737 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3 | 3 |
| |
4 | 4 |
| |
5 | 5 |
| |
6 |
| - | |
7 | 6 |
| |
8 | 7 |
| |
9 | 8 |
| |
|
Lines changed: 13 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
983 | 983 |
| |
984 | 984 |
| |
985 | 985 |
| |
986 |
| - | |
987 |
| - | |
988 |
| - | |
989 |
| - | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
990 | 999 |
| |
991 | 1000 |
| |
992 | 1001 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
93 | 93 |
| |
94 | 94 |
| |
95 | 95 |
| |
96 |
| - | |
| 96 | + | |
97 | 97 |
| |
98 | 98 |
| |
99 | 99 |
| |
|
Lines changed: 9 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
497 | 497 |
| |
498 | 498 |
| |
499 | 499 |
| |
500 |
| - | |
| 500 | + | |
501 | 501 |
| |
502 | 502 |
| |
503 | 503 |
| |
504 |
| - | |
505 |
| - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
506 | 511 |
| |
507 | 512 |
| |
508 |
| - | |
| 513 | + | |
509 | 514 |
| |
510 | 515 |
| |
511 | 516 |
| |
|
0 commit comments
Comments
(0)