forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitafccd76
committed
Fix detaching partitions with cloned row triggers
When a partition is detached, any triggers that had been cloned from itsparent were not properly disentangled from its parent triggers.This resulted in triggers that could not be dropped because theydepended on the trigger in the trigger in the no-longer-parent table: ALTER TABLE t DETACH PARTITION t1; DROP TRIGGER trig ON t1; ERROR: cannot drop trigger trig on table t1 because trigger trig on table t requires it HINT: You can drop trigger trig on table t instead.Moreover the table can no longer be re-attached to its parent, becausethe trigger name is already taken: ALTER TABLE t ATTACH PARTITION t1 FOR VALUES FROM (1)TO(2); ERROR: trigger "trig" for relation "t1" already existsThe former is a bug introduced in commit86f5759. (The latter isnot necessarily a bug, but it makes the bug more uncomfortable.)To avoid the complexity that would be needed to tell whether the triggerhas a local definition that has to be merged with the one coming fromthe parent table, establish the behavior that the trigger is removedwhen the table is detached.Backpatch to pg11.Author: Justin Pryzby <pryzby@telsasoft.com>Reviewed-by: Amit Langote <amitlangote09@gmail.com>Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>Discussion:https://www.postgresql.org/message-id/flat/20200408152412.GZ2228@telsasoft.com1 parent1542e16 commitafccd76
File tree
4 files changed
+131
-0
lines changed- doc/src/sgml/ref
- src
- backend/commands
- test/regress
- expected
- sql
4 files changed
+131
-0
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
526 | 526 |
| |
527 | 527 |
| |
528 | 528 |
| |
| 529 | + | |
529 | 530 |
| |
530 | 531 |
| |
531 | 532 |
| |
|
Lines changed: 64 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
547 | 547 |
| |
548 | 548 |
| |
549 | 549 |
| |
| 550 | + | |
550 | 551 |
| |
551 | 552 |
| |
552 | 553 |
| |
| |||
16797 | 16798 |
| |
16798 | 16799 |
| |
16799 | 16800 |
| |
| 16801 | + | |
| 16802 | + | |
| 16803 | + | |
16800 | 16804 |
| |
16801 | 16805 |
| |
16802 | 16806 |
| |
| |||
16881 | 16885 |
| |
16882 | 16886 |
| |
16883 | 16887 |
| |
| 16888 | + | |
| 16889 | + | |
| 16890 | + | |
| 16891 | + | |
| 16892 | + | |
| 16893 | + | |
| 16894 | + | |
| 16895 | + | |
| 16896 | + | |
| 16897 | + | |
| 16898 | + | |
| 16899 | + | |
| 16900 | + | |
| 16901 | + | |
| 16902 | + | |
| 16903 | + | |
| 16904 | + | |
| 16905 | + | |
| 16906 | + | |
| 16907 | + | |
| 16908 | + | |
| 16909 | + | |
| 16910 | + | |
| 16911 | + | |
| 16912 | + | |
| 16913 | + | |
| 16914 | + | |
| 16915 | + | |
| 16916 | + | |
| 16917 | + | |
| 16918 | + | |
| 16919 | + | |
| 16920 | + | |
| 16921 | + | |
| 16922 | + | |
| 16923 | + | |
| 16924 | + | |
| 16925 | + | |
| 16926 | + | |
| 16927 | + | |
| 16928 | + | |
| 16929 | + | |
| 16930 | + | |
| 16931 | + | |
| 16932 | + | |
| 16933 | + | |
| 16934 | + | |
| 16935 | + | |
| 16936 | + | |
| 16937 | + | |
| 16938 | + | |
| 16939 | + | |
| 16940 | + | |
| 16941 | + | |
| 16942 | + | |
| 16943 | + | |
| 16944 | + | |
| 16945 | + | |
| 16946 | + | |
| 16947 | + | |
16884 | 16948 |
| |
16885 | 16949 |
| |
16886 | 16950 |
| |
|
Lines changed: 45 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2023 | 2023 |
| |
2024 | 2024 |
| |
2025 | 2025 |
| |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
2026 | 2071 |
| |
2027 | 2072 |
| |
2028 | 2073 |
| |
|
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1380 | 1380 |
| |
1381 | 1381 |
| |
1382 | 1382 |
| |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
1383 | 1404 |
| |
1384 | 1405 |
| |
1385 | 1406 |
| |
|
0 commit comments
Comments
(0)