Commit 7b357cc
committed
Don't add a redundant constraint when detaching a partition
On ALTER TABLE .. DETACH CONCURRENTLY, we add a new table constraint
that duplicates the partition constraint. But if the partition already
has another constraint that implies that one, then that's unnecessary.
We were already avoiding the addition of a duplicate constraint if there
was an exact 'equal' match -- this just improves the quality of the check.
Author: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/20210410184226.GY6592@telsasoft.com1 parent e014d25 commit 7b357cc
File tree
3 files changed
+54
-33
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+54
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17915 | 17915 | | |
17916 | 17916 | | |
17917 | 17917 | | |
17918 | | - | |
| 17918 | + | |
| 17919 | + | |
17919 | 17920 | | |
17920 | 17921 | | |
17921 | 17922 | | |
17922 | 17923 | | |
17923 | | - | |
17924 | | - | |
17925 | | - | |
17926 | | - | |
| 17924 | + | |
17927 | 17925 | | |
17928 | | - | |
| 17926 | + | |
| 17927 | + | |
17929 | 17928 | | |
17930 | | - | |
17931 | | - | |
| 17929 | + | |
| 17930 | + | |
| 17931 | + | |
| 17932 | + | |
| 17933 | + | |
17932 | 17934 | | |
17933 | | - | |
17934 | | - | |
17935 | | - | |
17936 | | - | |
17937 | | - | |
17938 | | - | |
17939 | | - | |
17940 | | - | |
17941 | | - | |
| 17935 | + | |
| 17936 | + | |
| 17937 | + | |
| 17938 | + | |
| 17939 | + | |
| 17940 | + | |
| 17941 | + | |
| 17942 | + | |
| 17943 | + | |
| 17944 | + | |
| 17945 | + | |
| 17946 | + | |
| 17947 | + | |
| 17948 | + | |
| 17949 | + | |
| 17950 | + | |
| 17951 | + | |
| 17952 | + | |
17942 | 17953 | | |
17943 | | - | |
17944 | | - | |
17945 | | - | |
17946 | | - | |
17947 | | - | |
17948 | | - | |
17949 | | - | |
17950 | | - | |
17951 | | - | |
17952 | | - | |
17953 | | - | |
17954 | | - | |
17955 | | - | |
17956 | | - | |
17957 | | - | |
17958 | | - | |
17959 | 17954 | | |
17960 | 17955 | | |
17961 | 17956 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4191 | 4191 | | |
4192 | 4192 | | |
4193 | 4193 | | |
| 4194 | + | |
| 4195 | + | |
| 4196 | + | |
| 4197 | + | |
| 4198 | + | |
| 4199 | + | |
| 4200 | + | |
| 4201 | + | |
| 4202 | + | |
| 4203 | + | |
| 4204 | + | |
| 4205 | + | |
| 4206 | + | |
| 4207 | + | |
| 4208 | + | |
| 4209 | + | |
| 4210 | + | |
| 4211 | + | |
| 4212 | + | |
| 4213 | + | |
4194 | 4214 | | |
4195 | 4215 | | |
4196 | 4216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2696 | 2696 | | |
2697 | 2697 | | |
2698 | 2698 | | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
2699 | 2705 | | |
2700 | 2706 | | |
2701 | 2707 | | |
| |||
0 commit comments