forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit29f114b
committed
Allow subquery pullup to wrap a PlaceHolderVar in another one.
The code for wrapping subquery output expressions in PlaceHolderVarsbelieved that if the expression already was a PlaceHolderVar, it wasnever necessary to wrap that in another one. That's wrong if theexpression is underneath an outer join and involves a lateralreference to outside that scope: failing to add an additional PHVrisks evaluating the expression at the wrong place and hence notforcing it to null when the outer join should do so. This is anoversight in commit9e7e29c, which added logic to forcibly wraplateral-reference Vars in PlaceHolderVars, but didn't see that theadjacent case for PlaceHolderVars needed the same treatment.The test case we have for this doesn't fail before4be058f, but nowthat I see the problem I wonder if it is possible to demonstraterelated errors before that. That's moot though, since all suchbranches are out of support.Per bug #18284 from Holger Reise. Back-patch to all supportedbranches.Discussion:https://postgr.es/m/18284-47505a20c23647f8@postgresql.org1 parenta7097ca commit29f114b
File tree
3 files changed
+46
-2
lines changed- src
- backend/optimizer/prep
- test/regress
- expected
- sql
3 files changed
+46
-2
lines changedLines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2435 | 2435 |
| |
2436 | 2436 |
| |
2437 | 2437 |
| |
2438 |
| - | |
2439 |
| - | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
2440 | 2445 |
| |
2441 | 2446 |
| |
2442 | 2447 |
| |
|
Lines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7980 | 7980 |
| |
7981 | 7981 |
| |
7982 | 7982 |
| |
| 7983 | + | |
| 7984 | + | |
| 7985 | + | |
| 7986 | + | |
| 7987 | + | |
| 7988 | + | |
| 7989 | + | |
| 7990 | + | |
| 7991 | + | |
| 7992 | + | |
| 7993 | + | |
| 7994 | + | |
| 7995 | + | |
| 7996 | + | |
| 7997 | + | |
| 7998 | + | |
| 7999 | + | |
| 8000 | + | |
| 8001 | + | |
| 8002 | + | |
| 8003 | + | |
| 8004 | + | |
| 8005 | + | |
| 8006 | + | |
| 8007 | + | |
| 8008 | + | |
| 8009 | + | |
7983 | 8010 |
| |
7984 | 8011 |
| |
7985 | 8012 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2950 | 2950 |
| |
2951 | 2951 |
| |
2952 | 2952 |
| |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
2953 | 2965 |
| |
2954 | 2966 |
| |
2955 | 2967 |
| |
|
0 commit comments
Comments
(0)