- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit33a4699
committed
Avoid crash with WHERE CURRENT OF and a custom scan plan.
execCurrent.c's search_plan_tree() assumed that ForeignScanStatesand CustomScanStates necessarily have a valid ss_currentRelation.This is demonstrably untrue for postgres_fdw's remote join andremote aggregation plans, and non-leaf custom scans might not havean identifiable scan relation either. Avoid crashing by ignoringsuch nodes when the field is null.This solution will lead to errors like 'cursor "foo" is not asimply updatable scan of table "bar"' in cases where maybe wecould have allowed WHERE CURRENT OF to work. That's not an issuefor postgres_fdw's usages, since joins or aggregations would renderWHERE CURRENT OF invalid anyway. But an otherwise-transparentupper level custom scan node might find this annoying. When and ifsomeone cares to expend work on such a scenario, we could invent acustom-scan-provider callback to determine what's safe.Report and patch by David Geier, commentary by me. It's been likethis for awhile, so back-patch to all supported branches.Discussion:https://postgr.es/m/0253344d-9bdd-11c4-7f0d-d88c02cd7991@swarm64.com1 parentc424c75 commit33a4699
1 file changed
+8
-2
lines changedLines changed: 8 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
314 | 314 |
| |
315 | 315 |
| |
316 | 316 |
| |
317 |
| - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
318 | 323 |
| |
319 | 324 |
| |
320 | 325 |
| |
| |||
327 | 332 |
| |
328 | 333 |
| |
329 | 334 |
| |
330 |
| - | |
| 335 | + | |
| 336 | + | |
331 | 337 |
| |
332 | 338 |
| |
333 | 339 |
| |
|
0 commit comments
Comments
(0)