forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit94131cd
committed
Avoid assertion failure if a setop leaf query contains setops.
Ordinarily transformSetOperationTree will collect all UNION/INTERSECT/EXCEPT steps into the setOperations tree of the topmostQuery, so that leaf queries do not contain any setOperations.However, it cannot thus flatten a subquery that also containsWITH, ORDER BY, FOR UPDATE, or LIMIT. I (tgl) forgot that incommit07b4c48 and wrote an assertion in rule deparsing thata leaf's setOperations would always be empty.If it were nonempty then we would want to parenthesize the subqueryto ensure that the output represents the setop nesting correctly(e.g. UNION below INTERSECT had better get parenthesized). Sorather than just removing the faulty Assert, let's change it intoan additional case to check to decide whether to add parens. Wedon't expect that the additional case will ever fire, but it'scheap insurance.Man Zeng and Tom LaneDiscussion:https://postgr.es/m/tencent_7ABF9B1F23B0C77606FC5FE3@qq.com1 parent6c8f670 commit94131cd
1 file changed
+9
-3
lines changedLines changed: 9 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6353 | 6353 |
| |
6354 | 6354 |
| |
6355 | 6355 |
| |
6356 |
| - | |
6357 |
| - | |
| 6356 | + | |
| 6357 | + | |
| 6358 | + | |
| 6359 | + | |
| 6360 | + | |
| 6361 | + | |
| 6362 | + | |
6358 | 6363 |
| |
6359 | 6364 |
| |
6360 | 6365 |
| |
6361 | 6366 |
| |
6362 |
| - | |
| 6367 | + | |
| 6368 | + | |
6363 | 6369 |
| |
6364 | 6370 |
| |
6365 | 6371 |
| |
|
0 commit comments
Comments
(0)