forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit58d8024
committed
Fix assorted missing infrastructure for ON CONFLICT.
subquery_planner() failed to apply expression preprocessing to thearbiterElems and arbiterWhere fields of an OnConflictExpr. No doubt thetheory was that this wasn't necessary because we don't actually try toexecute those expressions; but that's wrong, because it results in failureto match to index expressions or index predicates that are changed at allby preprocessing. Per bug #14132 from Reynold Smith.Also add pullup_replace_vars processing for onConflictWhere. Perhapsit's impossible to have a subquery reference there, but I'm not exactlyconvinced; and even if true today it's a failure waiting to happen.Also add some comments to other places where one or another field ofOnConflictExpr is intentionally ignored, with explanation as to why it'sokay to do so.Also, catalog/dependency.c failed to record any dependency on the namedconstraint in ON CONFLICT ON CONSTRAINT, allowing such a constraint tobe dropped while rules exist that depend on it, and allowing pg_dump todump such a rule before the constraint it refers to. The normal executionpath managed to error out reasonably for a dangling constraint reference,but ruleutils.c dumped core; so in addition to fixing the omission, adda protective check in ruleutils.c, since we can't retroactively add adependency in existing databases.Back-patch to 9.5 where this code was introduced.Report: <20160510190350.2608.48667@wrigleys.postgresql.org>1 parent7516cdb commit58d8024
File tree
8 files changed
+94
-12
lines changed- src
- backend
- catalog
- optimizer
- plan
- prep
- util
- utils/adt
- test/regress
- expected
- sql
8 files changed
+94
-12
lines changedLines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1777 | 1777 |
| |
1778 | 1778 |
| |
1779 | 1779 |
| |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
1780 | 1789 |
| |
1781 | 1790 |
| |
1782 | 1791 |
| |
|
Lines changed: 14 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
65 | 65 |
| |
66 | 66 |
| |
67 | 67 |
| |
| 68 | + | |
68 | 69 |
| |
69 | 70 |
| |
70 | 71 |
| |
| |||
483 | 484 |
| |
484 | 485 |
| |
485 | 486 |
| |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
486 | 495 |
| |
487 |
| - | |
| 496 | + | |
| 497 | + | |
488 | 498 |
| |
489 |
| - | |
490 | 499 |
| |
491 |
| - | |
| 500 | + | |
| 501 | + | |
492 | 502 |
| |
| 503 | + | |
493 | 504 |
| |
494 | 505 |
| |
495 | 506 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2426 | 2426 |
| |
2427 | 2427 |
| |
2428 | 2428 |
| |
| 2429 | + | |
2429 | 2430 |
| |
2430 | 2431 |
| |
2431 | 2432 |
| |
|
Lines changed: 24 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1031 | 1031 |
| |
1032 | 1032 |
| |
1033 | 1033 |
| |
| 1034 | + | |
1034 | 1035 |
| |
1035 |
| - | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1036 | 1047 |
| |
1037 | 1048 |
| |
1038 | 1049 |
| |
| |||
1625 | 1636 |
| |
1626 | 1637 |
| |
1627 | 1638 |
| |
| 1639 | + | |
1628 | 1640 |
| |
1629 |
| - | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
1630 | 1652 |
| |
1631 | 1653 |
| |
1632 | 1654 |
| |
|
Lines changed: 4 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
530 | 530 |
| |
531 | 531 |
| |
532 | 532 |
| |
533 |
| - | |
534 | 533 |
| |
535 | 534 |
| |
536 | 535 |
| |
| |||
592 | 591 |
| |
593 | 592 |
| |
594 | 593 |
| |
| 594 | + | |
595 | 595 |
| |
596 | 596 |
| |
597 | 597 |
| |
| |||
652 | 652 |
| |
653 | 653 |
| |
654 | 654 |
| |
655 |
| - | |
656 |
| - | |
| 655 | + | |
| 656 | + | |
657 | 657 |
| |
658 | 658 |
| |
659 |
| - | |
660 | 659 |
| |
661 |
| - | |
| 660 | + | |
662 | 661 |
| |
663 | 662 |
| |
664 | 663 |
| |
|
Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5543 | 5543 |
| |
5544 | 5544 |
| |
5545 | 5545 |
| |
5546 |
| - | |
| 5546 | + | |
5547 | 5547 |
| |
5548 | 5548 |
| |
5549 | 5549 |
| |
| 5550 | + | |
| 5551 | + | |
| 5552 | + | |
5550 | 5553 |
| |
5551 |
| - | |
| 5554 | + | |
5552 | 5555 |
| |
5553 | 5556 |
| |
5554 | 5557 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
454 | 454 |
| |
455 | 455 |
| |
456 | 456 |
| |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
457 | 472 |
| |
458 | 473 |
| |
459 | 474 |
| |
|
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
261 | 261 |
| |
262 | 262 |
| |
263 | 263 |
| |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
264 | 286 |
| |
265 | 287 |
| |
266 | 288 |
| |
|
0 commit comments
Comments
(0)