Commit 0464fdf
committed
Create action triggers when partitions are detached
Detaching a partition from a partitioned table that's constrained by
foreign keys requires additional action triggers on the referenced side;
otherwise, DELETE/UPDATE actions there fail to notice rows in the table
that was partition, and so are incorrectly allowed through. With this
commit, those triggers are now created. Conversely, when a table that
has a foreign key is attached as a partition to a table that also has
the same foreign key, those action triggers are no longer needed, so we
remove them.
Add a minimal test case verifying (part of) this.
Authors: Amit Langote, Álvaro Herrera
Discussion: https://postgr.es/m/f2b8ead5-4131-d5a8-8016-2ea0a31250af@lab.ntt.co.jp1 parent 1755440 commit 0464fdf
File tree
3 files changed
+113
-5
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+113
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7851 | 7851 | | |
7852 | 7852 | | |
7853 | 7853 | | |
| 7854 | + | |
| 7855 | + | |
| 7856 | + | |
| 7857 | + | |
7854 | 7858 | | |
7855 | 7859 | | |
7856 | 7860 | | |
| |||
7902 | 7906 | | |
7903 | 7907 | | |
7904 | 7908 | | |
7905 | | - | |
| 7909 | + | |
| 7910 | + | |
| 7911 | + | |
| 7912 | + | |
| 7913 | + | |
| 7914 | + | |
| 7915 | + | |
| 7916 | + | |
| 7917 | + | |
| 7918 | + | |
| 7919 | + | |
| 7920 | + | |
| 7921 | + | |
| 7922 | + | |
| 7923 | + | |
| 7924 | + | |
| 7925 | + | |
| 7926 | + | |
| 7927 | + | |
| 7928 | + | |
| 7929 | + | |
| 7930 | + | |
| 7931 | + | |
| 7932 | + | |
| 7933 | + | |
| 7934 | + | |
| 7935 | + | |
| 7936 | + | |
| 7937 | + | |
| 7938 | + | |
| 7939 | + | |
| 7940 | + | |
| 7941 | + | |
7906 | 7942 | | |
7907 | 7943 | | |
7908 | 7944 | | |
| |||
15073 | 15109 | | |
15074 | 15110 | | |
15075 | 15111 | | |
15076 | | - | |
| 15112 | + | |
| 15113 | + | |
| 15114 | + | |
| 15115 | + | |
15077 | 15116 | | |
15078 | 15117 | | |
15079 | 15118 | | |
15080 | 15119 | | |
15081 | 15120 | | |
| 15121 | + | |
| 15122 | + | |
15082 | 15123 | | |
15083 | 15124 | | |
15084 | 15125 | | |
15085 | 15126 | | |
| 15127 | + | |
| 15128 | + | |
| 15129 | + | |
| 15130 | + | |
| 15131 | + | |
| 15132 | + | |
| 15133 | + | |
| 15134 | + | |
| 15135 | + | |
15086 | 15136 | | |
| 15137 | + | |
15087 | 15138 | | |
15088 | 15139 | | |
| 15140 | + | |
| 15141 | + | |
| 15142 | + | |
| 15143 | + | |
| 15144 | + | |
| 15145 | + | |
| 15146 | + | |
| 15147 | + | |
| 15148 | + | |
| 15149 | + | |
| 15150 | + | |
| 15151 | + | |
| 15152 | + | |
| 15153 | + | |
| 15154 | + | |
| 15155 | + | |
15089 | 15156 | | |
15090 | 15157 | | |
15091 | 15158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1921 | 1921 | | |
1922 | 1922 | | |
1923 | 1923 | | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
1924 | 1948 | | |
1925 | | - | |
1926 | | - | |
| 1949 | + | |
| 1950 | + | |
1927 | 1951 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1375 | 1375 | | |
1376 | 1376 | | |
1377 | 1377 | | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
1378 | 1395 | | |
1379 | | - | |
| 1396 | + | |
1380 | 1397 | | |
0 commit comments