forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit89b69db
committed
Allow examine_simple_variable() to work on INSERT RETURNING Vars.
Since commit599b33b, this function assumed that every RTE_RELATIONRangeTblEntry would have an associated RelOptInfo. But that's not so:we only build RelOptInfos for relations that are scanned by the query.In particular the target of an INSERT won't have one, so that Varsappearing in an INSERT ... RETURNING list will not have an associatedRelOptInfo. This apparently wasn't a problem before commitf7816aetaught examine_simple_variable() to drill down into CTEs containingINSERT RETURNING, but it is now.To fix, add a fallback code path that gets the userid to use directlyfrom the RTEPermissionInfo associated with the RTE. (Sadly, we musthave two code paths, because not every RTE has a RTEPermissionInfoeither.)Per report from Alexander Lakhin. No back-patch, since the case isapparently unreachable beforef7816ae.Discussion:https://postgr.es/m/608a4886-6c60-0f9e-97d5-591256bd4150@gmail.com1 parentbea18b1 commit89b69db
File tree
5 files changed
+56
-5
lines changed- src
- backend
- optimizer/util
- utils/adt
- include/optimizer
- test/regress
- expected
- sql
5 files changed
+56
-5
lines changedLines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
420 | 420 |
| |
421 | 421 |
| |
422 | 422 |
| |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
423 | 436 |
| |
424 | 437 |
| |
425 | 438 |
| |
|
Lines changed: 19 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
| 122 | + | |
122 | 123 |
| |
123 | 124 |
| |
124 | 125 |
| |
| |||
5434 | 5435 |
| |
5435 | 5436 |
| |
5436 | 5437 |
| |
5437 |
| - | |
| 5438 | + | |
5438 | 5439 |
| |
5439 | 5440 |
| |
5440 | 5441 |
| |
5441 | 5442 |
| |
5442 | 5443 |
| |
5443 |
| - | |
5444 |
| - | |
5445 |
| - | |
| 5444 | + | |
| 5445 | + | |
| 5446 | + | |
| 5447 | + | |
| 5448 | + | |
| 5449 | + | |
5446 | 5450 |
| |
5447 |
| - | |
| 5451 | + | |
| 5452 | + | |
| 5453 | + | |
| 5454 | + | |
| 5455 | + | |
| 5456 | + | |
| 5457 | + | |
| 5458 | + | |
| 5459 | + | |
| 5460 | + | |
| 5461 | + | |
5448 | 5462 |
| |
5449 | 5463 |
| |
5450 | 5464 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
307 | 307 |
| |
308 | 308 |
| |
309 | 309 |
| |
| 310 | + | |
310 | 311 |
| |
311 | 312 |
| |
312 | 313 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
654 | 654 |
| |
655 | 655 |
| |
656 | 656 |
| |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
657 | 675 |
| |
658 | 676 |
| |
659 | 677 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
354 | 354 |
| |
355 | 355 |
| |
356 | 356 |
| |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
357 | 362 |
| |
358 | 363 |
| |
359 | 364 |
| |
|
0 commit comments
Comments
(0)