- Notifications
You must be signed in to change notification settings - Fork28
Commit0b6edb9
committed
Fix ALTER COLUMN TYPE failure with a partial exclusion constraint.
ATExecAlterColumnType failed to consider the possibility that an indexthat needs to be rebuilt might be a child of a constraint that needs to berebuilt. We missed this so far because usually a constraint index doesn'thave a direct dependency on its table, just on the constraint object.But if there's a WHERE clause, then dependency analysis of the WHEREclause results in direct dependencies on the column(s) mentioned in WHERE.This led to trying to drop and rebuild both the constraint and itsunderlying index.In v11/HEAD, we successfully drop both the index and the constraint,and then try to rebuild both, and of course the second rebuild hits aduplicate-index-name problem. Before v11, it fails with obscure messagesabout a missing relation OID, due to trying to drop the index twice.This is essentially the same kind of problem noted in commit20bef2c: the possible dependency linkages are broader than whatATExecAlterColumnType was designed for. It was probably OK whenwritten, but it's certainly been broken since the introduction ofpartial exclusion constraints. Fix by adding an explicit checkfor whether any of the indexes-to-be-rebuilt belong to any of theconstraints-to-be-rebuilt, and ignoring any that do.In passing, fix a latent bug introduced by commit8b08f7d: inget_constraint_index() we must "continue" not "break" when rejectinga relation of a wrong relkind. This is harmless today because we don'texpect that code path to be taken anyway; but if there ever were anyrelations to be ignored, the existing coding would have an extremelyundesirable dependency on the order of pg_depend entries.Also adjust a couple of obsolete comments.Per bug #15835 from Yaroslav Schekin. Back-patch to all supportedbranches.Discussion:https://postgr.es/m/15835-32d9b7a76c06a7a9@postgresql.org1 parentfa5f3a4 commit0b6edb9
File tree
4 files changed
+118
-13
lines changed- src
- backend
- catalog
- commands
- test/regress
- expected
- sql
4 files changed
+118
-13
lines changedLines changed: 10 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
616 | 616 |
| |
617 | 617 |
| |
618 | 618 |
| |
619 |
| - | |
620 |
| - | |
| 619 | + | |
| 620 | + | |
621 | 621 |
| |
622 | 622 |
| |
623 | 623 |
| |
| |||
664 | 664 |
| |
665 | 665 |
| |
666 | 666 |
| |
667 |
| - | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
668 | 671 |
| |
669 | 672 |
| |
670 |
| - | |
| 673 | + | |
671 | 674 |
| |
672 | 675 |
| |
673 | 676 |
| |
| |||
682 | 685 |
| |
683 | 686 |
| |
684 | 687 |
| |
685 |
| - | |
686 |
| - | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
687 | 691 |
| |
688 | 692 |
| |
689 | 693 |
| |
|
Lines changed: 51 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9785 | 9785 |
| |
9786 | 9786 |
| |
9787 | 9787 |
| |
| 9788 | + | |
| 9789 | + | |
| 9790 | + | |
9788 | 9791 |
| |
9789 | 9792 |
| |
9790 | 9793 |
| |
| |||
9915 | 9918 |
| |
9916 | 9919 |
| |
9917 | 9920 |
| |
| 9921 | + | |
| 9922 | + | |
| 9923 | + | |
| 9924 | + | |
| 9925 | + | |
| 9926 | + | |
| 9927 | + | |
| 9928 | + | |
| 9929 | + | |
| 9930 | + | |
9918 | 9931 |
| |
9919 |
| - | |
9920 |
| - | |
9921 |
| - | |
9922 |
| - | |
9923 |
| - | |
9924 |
| - | |
9925 |
| - | |
| 9932 | + | |
| 9933 | + | |
| 9934 | + | |
9926 | 9935 |
| |
9927 | 9936 |
| |
9928 | 9937 |
| |
| |||
10073 | 10082 |
| |
10074 | 10083 |
| |
10075 | 10084 |
| |
| 10085 | + | |
| 10086 | + | |
| 10087 | + | |
| 10088 | + | |
| 10089 | + | |
| 10090 | + | |
| 10091 | + | |
| 10092 | + | |
| 10093 | + | |
| 10094 | + | |
| 10095 | + | |
| 10096 | + | |
| 10097 | + | |
| 10098 | + | |
| 10099 | + | |
| 10100 | + | |
| 10101 | + | |
| 10102 | + | |
| 10103 | + | |
| 10104 | + | |
| 10105 | + | |
| 10106 | + | |
| 10107 | + | |
| 10108 | + | |
| 10109 | + | |
| 10110 | + | |
| 10111 | + | |
| 10112 | + | |
| 10113 | + | |
| 10114 | + | |
| 10115 | + | |
| 10116 | + | |
| 10117 | + | |
| 10118 | + | |
| 10119 | + | |
10076 | 10120 |
| |
10077 | 10121 |
| |
10078 | 10122 |
| |
|
Lines changed: 40 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1990 | 1990 |
| |
1991 | 1991 |
| |
1992 | 1992 |
| |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
| 2015 | + | |
| 2016 | + | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
1993 | 2033 |
| |
1994 | 2034 |
| |
1995 | 2035 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1357 | 1357 |
| |
1358 | 1358 |
| |
1359 | 1359 |
| |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1360 | 1377 |
| |
1361 | 1378 |
| |
1362 | 1379 |
| |
|
0 commit comments
Comments
(0)