- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitc9d5298
committed
Re-implement pl/pgsql's expression and assignment parsing.
Invent new RawParseModes that allow the core grammar to handlepl/pgsql expressions and assignments directly, and thereby get ridof a lot of hackery in pl/pgsql's parser. This moves a good dealof knowledge about pl/pgsql into the core code: notably, we have toinvent a CoercionContext that matches pl/pgsql's (rather dubious)historical behavior for assignment coercions. That's getting awayfrom the original idea of pl/pgsql as an arm's-length extension ofthe core, but really we crossed that bridge a long time ago.The main advantage of doing this is that we can now use the coreparser to generate FieldStore and/or SubscriptingRef nodes to handleassignments to pl/pgsql variables that are records or arrays. Thatfixes a number of cases that had never been implemented in pl/pgsqlassignment, such as nested records and array slicing, and it allowspl/pgsql assignment to support the datatype-specific subscriptingbehaviors introduced in commitc7aba7c.There are cosmetic benefits too: when a syntax error occurs in apl/pgsql expression, the error report no longer includes the confusing"SELECT" keyword that used to get prefixed to the expression text.Also, there seem to be some small speed gains.Discussion:https://postgr.es/m/4165684.1607707277@sss.pgh.pa.us1 parent844fe9f commitc9d5298
File tree
32 files changed
+1081
-159
lines changed- contrib/hstore
- expected
- sql
- doc/src/sgml
- src
- backend
- commands
- executor
- nodes
- parser
- tcop
- include
- nodes
- parser
- interfaces/ecpg/preproc
- pl/plpgsql/src
- expected
- sql
- test/regress/expected
32 files changed
+1081
-159
lines changedLines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1583 | 1583 |
| |
1584 | 1584 |
| |
1585 | 1585 |
| |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
1586 | 1590 |
| |
1587 | 1591 |
| |
1588 | 1592 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
372 | 372 |
| |
373 | 373 |
| |
374 | 374 |
| |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
375 | 379 |
| |
376 | 380 |
| |
377 | 381 |
| |
|
Lines changed: 19 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
946 | 946 |
| |
947 | 947 |
| |
948 | 948 |
| |
949 |
| - | |
950 |
| - | |
| 949 | + | |
| 950 | + | |
951 | 951 |
| |
952 | 952 |
| |
953 | 953 |
| |
| |||
968 | 968 |
| |
969 | 969 |
| |
970 | 970 |
| |
| 971 | + | |
| 972 | + | |
| 973 | + | |
971 | 974 |
| |
972 | 975 |
| |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
973 | 990 |
| |
974 | 991 |
| |
975 | 992 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1628 | 1628 |
| |
1629 | 1629 |
| |
1630 | 1630 |
| |
| 1631 | + | |
1631 | 1632 |
| |
1632 | 1633 |
| |
1633 | 1634 |
| |
|
Lines changed: 46 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
51 | 51 |
| |
52 | 52 |
| |
53 | 53 |
| |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
54 | 60 |
| |
55 | 61 |
| |
56 | 62 |
| |
| |||
1479 | 1485 |
| |
1480 | 1486 |
| |
1481 | 1487 |
| |
| 1488 | + | |
1482 | 1489 |
| |
1483 | 1490 |
| |
1484 | 1491 |
| |
| |||
1533 | 1540 |
| |
1534 | 1541 |
| |
1535 | 1542 |
| |
| 1543 | + | |
| 1544 | + | |
1536 | 1545 |
| |
1537 |
| - | |
| 1546 | + | |
1538 | 1547 |
| |
1539 | 1548 |
| |
1540 | 1549 |
| |
| |||
1952 | 1961 |
| |
1953 | 1962 |
| |
1954 | 1963 |
| |
| 1964 | + | |
1955 | 1965 |
| |
1956 | 1966 |
| |
1957 | 1967 |
| |
| |||
1966 | 1976 |
| |
1967 | 1977 |
| |
1968 | 1978 |
| |
| 1979 | + | |
| 1980 | + | |
1969 | 1981 |
| |
1970 |
| - | |
| 1982 | + | |
1971 | 1983 |
| |
1972 | 1984 |
| |
1973 | 1985 |
| |
| |||
2094 | 2106 |
| |
2095 | 2107 |
| |
2096 | 2108 |
| |
| 2109 | + | |
2097 | 2110 |
| |
2098 | 2111 |
| |
2099 | 2112 |
| |
2100 | 2113 |
| |
2101 | 2114 |
| |
| 2115 | + | |
| 2116 | + | |
2102 | 2117 |
| |
2103 |
| - | |
| 2118 | + | |
2104 | 2119 |
| |
2105 | 2120 |
| |
2106 | 2121 |
| |
| |||
2199 | 2214 |
| |
2200 | 2215 |
| |
2201 | 2216 |
| |
| 2217 | + | |
2202 | 2218 |
| |
2203 | 2219 |
| |
2204 | 2220 |
| |
2205 | 2221 |
| |
2206 | 2222 |
| |
| 2223 | + | |
| 2224 | + | |
2207 | 2225 |
| |
2208 |
| - | |
| 2226 | + | |
2209 | 2227 |
| |
2210 | 2228 |
| |
2211 | 2229 |
| |
| |||
2263 | 2281 |
| |
2264 | 2282 |
| |
2265 | 2283 |
| |
| 2284 | + | |
2266 | 2285 |
| |
2267 | 2286 |
| |
2268 | 2287 |
| |
2269 | 2288 |
| |
2270 | 2289 |
| |
2271 | 2290 |
| |
2272 | 2291 |
| |
| 2292 | + | |
| 2293 | + | |
2273 | 2294 |
| |
2274 |
| - | |
| 2295 | + | |
2275 | 2296 |
| |
2276 | 2297 |
| |
2277 | 2298 |
| |
| |||
2318 | 2339 |
| |
2319 | 2340 |
| |
2320 | 2341 |
| |
2321 |
| - | |
| 2342 | + | |
2322 | 2343 |
| |
2323 | 2344 |
| |
2324 | 2345 |
| |
| |||
2722 | 2743 |
| |
2723 | 2744 |
| |
2724 | 2745 |
| |
2725 |
| - | |
| 2746 | + | |
| 2747 | + | |
2726 | 2748 |
| |
2727 | 2749 |
| |
2728 | 2750 |
| |
| |||
2740 | 2762 |
| |
2741 | 2763 |
| |
2742 | 2764 |
| |
2743 |
| - | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
2744 | 2782 |
| |
2745 | 2783 |
| |
2746 | 2784 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3199 | 3199 |
| |
3200 | 3200 |
| |
3201 | 3201 |
| |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
3202 | 3216 |
| |
3203 | 3217 |
| |
3204 | 3218 |
| |
| |||
5220 | 5234 |
| |
5221 | 5235 |
| |
5222 | 5236 |
| |
| 5237 | + | |
| 5238 | + | |
| 5239 | + | |
5223 | 5240 |
| |
5224 | 5241 |
| |
5225 | 5242 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1085 | 1085 |
| |
1086 | 1086 |
| |
1087 | 1087 |
| |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
1088 | 1100 |
| |
1089 | 1101 |
| |
1090 | 1102 |
| |
| |||
3275 | 3287 |
| |
3276 | 3288 |
| |
3277 | 3289 |
| |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
3278 | 3293 |
| |
3279 | 3294 |
| |
3280 | 3295 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3669 | 3669 |
| |
3670 | 3670 |
| |
3671 | 3671 |
| |
| 3672 | + | |
| 3673 | + | |
| 3674 | + | |
| 3675 | + | |
| 3676 | + | |
| 3677 | + | |
| 3678 | + | |
| 3679 | + | |
| 3680 | + | |
| 3681 | + | |
3672 | 3682 |
| |
3673 | 3683 |
| |
3674 | 3684 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2775 | 2775 |
| |
2776 | 2776 |
| |
2777 | 2777 |
| |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
2778 | 2790 |
| |
2779 | 2791 |
| |
2780 | 2792 |
| |
| |||
4211 | 4223 |
| |
4212 | 4224 |
| |
4213 | 4225 |
| |
| 4226 | + | |
| 4227 | + | |
| 4228 | + | |
4214 | 4229 |
| |
4215 | 4230 |
| |
4216 | 4231 |
| |
|
0 commit comments
Comments
(0)