forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf946a40
committed
Further fix ALTER COLUMN TYPE's handling of indexes and index constraints.
This patch reverts all the code changes of commite76de88, which turnsout to have been seriously misguided. We can't wait till later to computethe definition string for an index; we must capture that before applyingthe data type change for any column it depends on, else ruleutils.c willdeliverr wrong/misleading results. (This fine point was documentednowhere, of course.)I'd also managed to forget that ATExecAlterColumnType executes once perALTER COLUMN TYPE clause, not once per statement; which resulted in thecode being basically completely broken for any case in which multiple ALTERCOLUMN TYPE clauses are applied to a table having non-constraint indexesthat must be rebuilt. Through very bad luck, none of the existing testcases nor the ones added bye76de88 caught that, but of course it wassoon found in the field.The previous patch also had an implicit assumption that if a constraint'sindex had a dependency on a table column, so would the constraint --- butthat isn't actually true, so it didn't fix such cases.Instead of trying to delete unneeded index dependencies later, do theis-there-a-constraint lookup immediately on seeing an index dependency,and switch to remembering the constraint if so. In the unusual case ofmultiple column dependencies for a constraint index, this will result induplicate constraint lookups, but that's not that horrible compared to allthe other work that happens here. Besides, such cases did not work at allbefore, so it's hard to argue that they're performance-critical for anyone.Per bug #15865 from Keith Fiske. As before, back-patch to all supportedbranches.Discussion:https://postgr.es/m/15865-17940eacc8f8b081@postgresql.org1 parentb00326d commitf946a40
File tree
3 files changed
+103
-72
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+103
-72
lines changedLines changed: 73 additions & 68 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
456 | 456 |
| |
457 | 457 |
| |
458 | 458 |
| |
| 459 | + | |
| 460 | + | |
459 | 461 |
| |
460 | 462 |
| |
461 | 463 |
| |
| |||
10508 | 10510 |
| |
10509 | 10511 |
| |
10510 | 10512 |
| |
10511 |
| - | |
10512 |
| - | |
10513 |
| - | |
10514 | 10513 |
| |
10515 | 10514 |
| |
10516 | 10515 |
| |
| |||
10603 | 10602 |
| |
10604 | 10603 |
| |
10605 | 10604 |
| |
10606 |
| - | |
10607 |
| - | |
10608 |
| - | |
10609 |
| - | |
10610 |
| - | |
10611 | 10605 |
| |
10612 | 10606 |
| |
10613 | 10607 |
| |
| |||
10649 | 10643 |
| |
10650 | 10644 |
| |
10651 | 10645 |
| |
10652 |
| - | |
10653 |
| - | |
10654 |
| - | |
10655 |
| - | |
10656 |
| - | |
10657 |
| - | |
10658 |
| - | |
10659 |
| - | |
10660 |
| - | |
10661 |
| - | |
10662 | 10646 |
| |
10663 |
| - | |
10664 |
| - | |
10665 |
| - | |
| 10647 | + | |
10666 | 10648 |
| |
10667 | 10649 |
| |
10668 | 10650 |
| |
| |||
10698 | 10680 |
| |
10699 | 10681 |
| |
10700 | 10682 |
| |
10701 |
| - | |
10702 |
| - | |
10703 |
| - | |
10704 |
| - | |
10705 |
| - | |
10706 |
| - | |
10707 |
| - | |
10708 |
| - | |
10709 |
| - | |
10710 |
| - | |
10711 |
| - | |
10712 |
| - | |
| 10683 | + | |
10713 | 10684 |
| |
10714 | 10685 |
| |
10715 | 10686 |
| |
| |||
10828 | 10799 |
| |
10829 | 10800 |
| |
10830 | 10801 |
| |
10831 |
| - | |
10832 |
| - | |
10833 |
| - | |
10834 |
| - | |
10835 |
| - | |
10836 |
| - | |
10837 |
| - | |
10838 |
| - | |
10839 |
| - | |
10840 |
| - | |
10841 |
| - | |
10842 |
| - | |
10843 |
| - | |
10844 |
| - | |
10845 |
| - | |
10846 |
| - | |
10847 |
| - | |
10848 |
| - | |
10849 |
| - | |
10850 |
| - | |
10851 |
| - | |
10852 |
| - | |
10853 |
| - | |
10854 |
| - | |
10855 |
| - | |
10856 |
| - | |
10857 |
| - | |
10858 |
| - | |
10859 |
| - | |
10860 |
| - | |
10861 |
| - | |
10862 |
| - | |
10863 |
| - | |
10864 |
| - | |
10865 |
| - | |
10866 | 10802 |
| |
10867 | 10803 |
| |
10868 | 10804 |
| |
| |||
11043 | 10979 |
| |
11044 | 10980 |
| |
11045 | 10981 |
| |
| 10982 | + | |
| 10983 | + | |
| 10984 | + | |
| 10985 | + | |
| 10986 | + | |
| 10987 | + | |
| 10988 | + | |
| 10989 | + | |
| 10990 | + | |
| 10991 | + | |
| 10992 | + | |
| 10993 | + | |
| 10994 | + | |
| 10995 | + | |
| 10996 | + | |
| 10997 | + | |
| 10998 | + | |
| 10999 | + | |
| 11000 | + | |
| 11001 | + | |
| 11002 | + | |
| 11003 | + | |
| 11004 | + | |
| 11005 | + | |
| 11006 | + | |
| 11007 | + | |
| 11008 | + | |
| 11009 | + | |
| 11010 | + | |
| 11011 | + | |
| 11012 | + | |
| 11013 | + | |
| 11014 | + | |
| 11015 | + | |
| 11016 | + | |
| 11017 | + | |
| 11018 | + | |
| 11019 | + | |
| 11020 | + | |
| 11021 | + | |
| 11022 | + | |
| 11023 | + | |
| 11024 | + | |
| 11025 | + | |
| 11026 | + | |
| 11027 | + | |
| 11028 | + | |
| 11029 | + | |
| 11030 | + | |
| 11031 | + | |
| 11032 | + | |
| 11033 | + | |
| 11034 | + | |
| 11035 | + | |
| 11036 | + | |
| 11037 | + | |
| 11038 | + | |
| 11039 | + | |
| 11040 | + | |
| 11041 | + | |
| 11042 | + | |
| 11043 | + | |
| 11044 | + | |
| 11045 | + | |
| 11046 | + | |
| 11047 | + | |
| 11048 | + | |
| 11049 | + | |
| 11050 | + | |
11046 | 11051 |
| |
11047 | 11052 |
| |
11048 | 11053 |
| |
|
Lines changed: 20 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1900 | 1900 |
| |
1901 | 1901 |
| |
1902 | 1902 |
| |
1903 |
| - | |
1904 |
| - | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
1905 | 1906 |
| |
1906 | 1907 |
| |
1907 | 1908 |
| |
1908 | 1909 |
| |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
1909 | 1916 |
| |
1910 | 1917 |
| |
1911 | 1918 |
| |
| |||
1914 | 1921 |
| |
1915 | 1922 |
| |
1916 | 1923 |
| |
| 1924 | + | |
1917 | 1925 |
| |
1918 | 1926 |
| |
| 1927 | + | |
1919 | 1928 |
| |
| 1929 | + | |
| 1930 | + | |
1920 | 1931 |
| |
1921 | 1932 |
| |
| 1933 | + | |
1922 | 1934 |
| |
1923 | 1935 |
| |
1924 | 1936 |
| |
1925 | 1937 |
| |
1926 | 1938 |
| |
1927 | 1939 |
| |
| 1940 | + | |
1928 | 1941 |
| |
1929 | 1942 |
| |
1930 | 1943 |
| |
| |||
1933 | 1946 |
| |
1934 | 1947 |
| |
1935 | 1948 |
| |
| 1949 | + | |
1936 | 1950 |
| |
1937 | 1951 |
| |
| 1952 | + | |
1938 | 1953 |
| |
| 1954 | + | |
| 1955 | + | |
1939 | 1956 |
| |
1940 | 1957 |
| |
| 1958 | + | |
1941 | 1959 |
| |
1942 | 1960 |
| |
1943 | 1961 |
| |
|
Lines changed: 10 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1317 | 1317 |
| |
1318 | 1318 |
| |
1319 | 1319 |
| |
1320 |
| - | |
1321 |
| - | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
1322 | 1323 |
| |
1323 | 1324 |
| |
1324 | 1325 |
| |
1325 | 1326 |
| |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
1326 | 1333 |
| |
1327 | 1334 |
| |
1328 | 1335 |
| |
1329 | 1336 |
| |
1330 | 1337 |
| |
1331 | 1338 |
| |
1332 | 1339 |
| |
| 1340 | + | |
1333 | 1341 |
| |
1334 | 1342 |
| |
1335 | 1343 |
| |
|
0 commit comments
Comments
(0)