forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit82593b9

Etsuro Fujita
postgres_fdw: Disable batch insertion when there are WCO constraints.
When inserting a view referencing a foreign table that has WITH CHECKOPTION constraints, in single-insert mode postgres_fdw retrieves thedata that was actually inserted on the remote side so that the WITHCHECK OPTION constraints are enforced with the data locally, but inbatch-insert mode it cannot currently retrieve the data (except for therow first inserted through the view), resulting in enforcing the WITHCHECK OPTION constraints with the data passed from the core (except forthe first-inserted row), which led to incorrect results when insertinginto a view referencing a foreign table in which a remote BEFORE ROWINSERT trigger changes the rows inserted through the view so that theyviolate the view's WITH CHECK OPTION constraint. Also, the queryinserting into the view caused an assertion failure in assert-enabledbuilds.Fix these by disabling batch insertion when inserting into such a view.Back-patch to v14 where batch insertion was added.Discussion:https://postgr.es/m/CAPmGK17LpbTZs4m4a_6THP54UBeK9fHvX8aVVA%2BC6yEZDZwQcg%40mail.gmail.com1 parentec0925c commit82593b9
File tree
3 files changed
+64
-2
lines changed- contrib/postgres_fdw
- expected
- sql
3 files changed
+64
-2
lines changedLines changed: 44 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6544 | 6544 |
| |
6545 | 6545 |
| |
6546 | 6546 |
| |
| 6547 | + | |
| 6548 | + | |
| 6549 | + | |
| 6550 | + | |
| 6551 | + | |
| 6552 | + | |
| 6553 | + | |
| 6554 | + | |
| 6555 | + | |
| 6556 | + | |
| 6557 | + | |
| 6558 | + | |
| 6559 | + | |
| 6560 | + | |
| 6561 | + | |
| 6562 | + | |
| 6563 | + | |
| 6564 | + | |
| 6565 | + | |
| 6566 | + | |
| 6567 | + | |
| 6568 | + | |
| 6569 | + | |
6547 | 6570 |
| |
6548 | 6571 |
| |
6549 | 6572 |
| |
| |||
6636 | 6659 |
| |
6637 | 6660 |
| |
6638 | 6661 |
| |
| 6662 | + | |
| 6663 | + | |
| 6664 | + | |
| 6665 | + | |
| 6666 | + | |
| 6667 | + | |
| 6668 | + | |
| 6669 | + | |
| 6670 | + | |
| 6671 | + | |
| 6672 | + | |
| 6673 | + | |
| 6674 | + | |
| 6675 | + | |
| 6676 | + | |
| 6677 | + | |
| 6678 | + | |
| 6679 | + | |
| 6680 | + | |
| 6681 | + | |
| 6682 | + | |
6639 | 6683 |
| |
6640 | 6684 |
| |
6641 | 6685 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2043 | 2043 |
| |
2044 | 2044 |
| |
2045 | 2045 |
| |
2046 |
| - | |
2047 |
| - | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
2048 | 2049 |
| |
2049 | 2050 |
| |
2050 | 2051 |
| |
2051 | 2052 |
| |
2052 | 2053 |
| |
2053 | 2054 |
| |
2054 | 2055 |
| |
| 2056 | + | |
2055 | 2057 |
| |
2056 | 2058 |
| |
2057 | 2059 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1505 | 1505 |
| |
1506 | 1506 |
| |
1507 | 1507 |
| |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
1508 | 1516 |
| |
1509 | 1517 |
| |
1510 | 1518 |
| |
| |||
1543 | 1551 |
| |
1544 | 1552 |
| |
1545 | 1553 |
| |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
1546 | 1562 |
| |
1547 | 1563 |
| |
1548 | 1564 |
| |
|
0 commit comments
Comments
(0)