forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit46e3442
committed
Fix failures in validateForeignKeyConstraint's slow path.
The foreign-key-checking loop in ATRewriteTables failed to ignorerelations without storage (e.g., partitioned tables), unlike theinitial loop. This accidentally worked as long as RI_Initial_Checksucceeded, which it does in most practical cases (including all theones exercised in the existing regression tests :-(). However, ifthat failed, as for instance when there are permissions issues,then we entered the slow fire-the-trigger-on-each-tuple path.And that would try to read from the referencing relation, and failif it lacks storage.A second problem, recently introduced in HEAD, was that this loophad been broken by sloppy refactoring for the tableam API changes.Repair both issues, and add a regression test case so we have somecoverage on this code path. Back-patch as needed to v11.(It looks like this code could do with additional bulletproofing,but let's get a working test case in place first.)Hadi Moshayedi, Tom Lane, Andres FreundDiscussion:https://postgr.es/m/CAK=1=WrnNmBbe5D9sm3t0a6dnAq3cdbF1vXY816j1wsMqzC8bw@mail.gmail.comDiscussion:https://postgr.es/m/19030.1554574075@sss.pgh.pa.usDiscussion:https://postgr.es/m/20190325180405.jytoehuzkeozggxx%40alap3.anarazel.de1 parent249d649 commit46e3442
File tree
3 files changed
+58
-8
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+58
-8
lines changedLines changed: 7 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4459 | 4459 |
| |
4460 | 4460 |
| |
4461 | 4461 |
| |
4462 |
| - | |
4463 |
| - | |
4464 |
| - | |
4465 |
| - | |
4466 |
| - | |
4467 |
| - | |
4468 |
| - | |
| 4462 | + | |
| 4463 | + | |
4469 | 4464 |
| |
4470 | 4465 |
| |
4471 | 4466 |
| |
| |||
4645 | 4640 |
| |
4646 | 4641 |
| |
4647 | 4642 |
| |
| 4643 | + | |
| 4644 | + | |
| 4645 | + | |
| 4646 | + | |
4648 | 4647 |
| |
4649 | 4648 |
| |
4650 | 4649 |
| |
| |||
9647 | 9646 |
| |
9648 | 9647 |
| |
9649 | 9648 |
| |
9650 |
| - | |
| 9649 | + | |
9651 | 9650 |
| |
9652 | 9651 |
| |
9653 | 9652 |
| |
|
Lines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1895 | 1895 |
| |
1896 | 1896 |
| |
1897 | 1897 |
| |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
1898 | 1924 |
| |
1899 | 1925 |
| |
1900 | 1926 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1365 | 1365 |
| |
1366 | 1366 |
| |
1367 | 1367 |
| |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
1368 | 1393 |
| |
1369 | 1394 |
| |
1370 | 1395 |
| |
|
0 commit comments
Comments
(0)