forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfa4f118
committed
SQL/JSON: Fix some oversights in commitb6e1157
The decision inb6e1157 to ignore raw_expr when evaluating aJsonValueExpr was incorrect. While its value is not ultimatelyused (since formatted_expr's value is), failing to initialize itcan lead to problems, for instance, when the expression tree inraw_expr contains Aggref nodes, which must be initialized toensure the parent Agg node works correctly.Also, optimize eval_const_expressions_mutator()'s handling ofJsonValueExpr a bit. Currently, when formatted_expr cannot be foldedinto a constant, we end up processing it twice -- once directly ineval_const_expressions_mutator() and again recursively viaece_generic_processing(). This recursive processing is required tohandle raw_expr. To avoid the redundant processing of formatted_expr,we now process raw_expr directly in eval_const_expressions_mutator().Finally, update the comment of JsonValueExpr to describe the roles ofraw_expr and formatted_expr more clearly.Bug: #18657Reported-by: Alexander Lakhin <exclusion@gmail.com>Diagnosed-by: Fabio R. Sluzala <fabio3rs@gmail.com>Diagnosed-by: Tender Wang <tndrwang@gmail.com>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/18657-1b90ccce2b16bdb8@postgresql.orgBackpatch-through: 161 parent0f40458 commitfa4f118
File tree
5 files changed
+92
-11
lines changed- src
- backend
- executor
- optimizer/util
- include/nodes
- test/regress
- expected
- sql
5 files changed
+92
-11
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2294 | 2294 |
| |
2295 | 2295 |
| |
2296 | 2296 |
| |
| 2297 | + | |
| 2298 | + | |
2297 | 2299 |
| |
2298 | 2300 |
| |
2299 | 2301 |
| |
|
Lines changed: 18 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2897 | 2897 |
| |
2898 | 2898 |
| |
2899 | 2899 |
| |
2900 |
| - | |
| 2900 | + | |
| 2901 | + | |
2901 | 2902 |
| |
2902 |
| - | |
2903 |
| - | |
2904 |
| - | |
2905 |
| - | |
2906 |
| - | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
2907 | 2919 |
| |
2908 | 2920 |
| |
2909 | 2921 |
| |
|
Lines changed: 9 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1596 | 1596 |
| |
1597 | 1597 |
| |
1598 | 1598 |
| |
1599 |
| - | |
1600 |
| - | |
1601 |
| - | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
1602 | 1606 |
| |
1603 | 1607 |
| |
1604 | 1608 |
| |
1605 | 1609 |
| |
1606 |
| - | |
1607 |
| - | |
| 1610 | + | |
| 1611 | + | |
1608 | 1612 |
| |
1609 | 1613 |
| |
1610 | 1614 |
| |
|
Lines changed: 49 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
951 | 951 |
| |
952 | 952 |
| |
953 | 953 |
| |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + |
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
383 | 383 |
| |
384 | 384 |
| |
385 | 385 |
| |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + |
0 commit comments
Comments
(0)