forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit12e116a
committed
Put back one copyObject() in rewriteTargetView().
Commit6f8cb1e tried to centralize rewriteTargetView's copyingof a target view's Query struct. However, it ignored the fact that thejointree->quals field was used twice. This only accidentally failed tofail immediately because the same ChangeVarNodes mutation is applied inboth cases, so that we end up with logically identical expression treesfor both uses (and, as the code stands, the second ChangeVarNodes callactually does nothing). However, we end up linking *physically*identical expression trees into both an RTE's securityQuals list andthe WithCheckOption list. That's pretty dangerous, mainly becauseprepsecurity.c is utterly cavalier about further munging such structureswithout copying them first.There may be no live bug in HEAD as a consequence of the fact that we applypreprocess_expression in between here and prepsecurity.c, and that willmake a copy of the tree anyway. Or it may just be that the regressiontests happen to not trip over it. (I noticed this only because thingsfell over pretty badly when I tried to relocate the planner's call ofexpand_security_quals to before expression preprocessing.) In any caseit's very fragile because if anyone tried to make the securityQuals andWithCheckOption trees diverge before we reach preprocess_expression, itwould not work. The fact that the current code will preprocesssecurityQuals and WithCheckOptions lists at completely different times indifferent query levels does nothing to increase my trust that that can'thappen.In view of the fact that 9.5.0 is almost upon us and the aforesaid commithas seen exactly zero field testing, the prudent course is to make an extracopy of the quals so that the behavior is not different from what has beenin the field during beta.1 parent3b3e8fc commit12e116a
1 file changed
+7
-0
lines changedLines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2825 | 2825 |
| |
2826 | 2826 |
| |
2827 | 2827 |
| |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
2828 | 2835 |
| |
2829 | 2836 |
| |
2830 | 2837 |
| |
|
0 commit comments
Comments
(0)