Commit b4bcc6b
committed
Fix SET CONSTRAINTS .. DEFERRED on partitioned tables
SET CONSTRAINTS ... DEFERRED failed on partitioned tables, because of a
sanity check that ensures that the affected constraints have triggers.
On partitioned tables, the triggers are in the leaf partitions, not in
the partitioned relations themselves, so the sanity check fails.
Removing the sanity check solves the problem, because the code needed to
support the case is already there.
Backpatch to 11.
Note: deferred unique constraints are not affected by this bug, because
they do have triggers in the parent partitioned table. I did not add a
test for this scenario.
Discussion: https://postgr.es/m/20191105212915.GA11324@alvherre.pgsql1 parent a7145f6 commit b4bcc6b
File tree
3 files changed
+97
-14
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+97
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5510 | 5510 | | |
5511 | 5511 | | |
5512 | 5512 | | |
5513 | | - | |
5514 | 5513 | | |
5515 | 5514 | | |
5516 | 5515 | | |
5517 | 5516 | | |
5518 | | - | |
5519 | | - | |
5520 | 5517 | | |
5521 | 5518 | | |
5522 | 5519 | | |
| |||
5537 | 5534 | | |
5538 | 5535 | | |
5539 | 5536 | | |
5540 | | - | |
5541 | | - | |
5542 | 5537 | | |
5543 | 5538 | | |
5544 | 5539 | | |
5545 | | - | |
5546 | | - | |
5547 | | - | |
5548 | | - | |
5549 | | - | |
5550 | 5540 | | |
5551 | 5541 | | |
5552 | 5542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2040 | 2040 | | |
2041 | 2041 | | |
2042 | 2042 | | |
2043 | | - | |
2044 | | - | |
2045 | | - | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
2046 | 2065 | | |
2047 | 2066 | | |
2048 | 2067 | | |
| |||
2267 | 2286 | | |
2268 | 2287 | | |
2269 | 2288 | | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
2270 | 2320 | | |
2271 | 2321 | | |
2272 | 2322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1455 | 1455 | | |
1456 | 1456 | | |
1457 | 1457 | | |
1458 | | - | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
1459 | 1477 | | |
1460 | 1478 | | |
1461 | 1479 | | |
| |||
1595 | 1613 | | |
1596 | 1614 | | |
1597 | 1615 | | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
1598 | 1641 | | |
1599 | 1642 | | |
1600 | 1643 | | |
| |||
0 commit comments