- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit47ea461
committed
Fix handling of inherited check constraints in ALTER COLUMN TYPE (again).
The previous way of reconstructing check constraints was to do a separate"ALTER TABLE ONLY tab ADD CONSTRAINT" for each table in an inheritancehierarchy. However, that way has no hope of reconstructing the checkconstraints' own inheritance properties correctly, as pointed out inbug #13779 from Jan Dirk Zijlstra. What we should do instead is to doa regular "ALTER TABLE", allowing recursion, at the topmost table thathas a particular constraint, and then suppress the work queue entriesfor inherited instances of the constraint.Annoyingly, we'd tried to fix this behavior before, in commit5ed6546,but we failed to notice that it wasn't reconstructing the pg_constraintfield values correctly.As long as I'm touching pg_get_constraintdef_worker anyway, tweak it toalways schema-qualify the target table name; this seems like useful backupto the protections installed by commit5f17304.In HEAD/9.5, get rid of get_constraint_relation_oids, which is now unused.(I could alternatively have modified it to also return conislocal, but thatseemed like a pretty single-purpose API, so let's not pretend it has someother use.) It's unused in the back branches as well, but I left it inplace just in case some third-party code has decided to use it.In HEAD/9.5, also rename pg_get_constraintdef_string topg_get_constraintdef_command, as the previous name did nothing to explainwhat that entry point did differently from others (and its comment wasequally useless). Again, that change doesn't seem like material forback-patching.I did a bit of re-pgindenting in tablecmds.c in HEAD/9.5, as well.Otherwise, back-patch to all supported branches.1 parent9892cc2 commit47ea461
File tree
4 files changed
+229
-41
lines changed- src
- backend
- commands
- utils/adt
- test/regress
- expected
- sql
4 files changed
+229
-41
lines changedLines changed: 24 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3390 | 3390 |
| |
3391 | 3391 |
| |
3392 | 3392 |
| |
3393 |
| - | |
| 3393 | + | |
3394 | 3394 |
| |
3395 | 3395 |
| |
3396 | 3396 |
| |
| |||
5764 | 5764 |
| |
5765 | 5765 |
| |
5766 | 5766 |
| |
5767 |
| - | |
5768 |
| - | |
5769 |
| - | |
5770 |
| - | |
5771 |
| - | |
5772 |
| - | |
5773 |
| - | |
5774 | 5767 |
| |
5775 | 5768 |
| |
5776 | 5769 |
| |
| |||
5798 | 5791 |
| |
5799 | 5792 |
| |
5800 | 5793 |
| |
5801 |
| - | |
| 5794 | + | |
5802 | 5795 |
| |
5803 | 5796 |
| |
5804 | 5797 |
| |
| |||
5842 | 5835 |
| |
5843 | 5836 |
| |
5844 | 5837 |
| |
5845 |
| - | |
5846 |
| - | |
5847 | 5838 |
| |
5848 |
| - | |
| 5839 | + | |
5849 | 5840 |
| |
5850 | 5841 |
| |
5851 | 5842 |
| |
| |||
8204 | 8195 |
| |
8205 | 8196 |
| |
8206 | 8197 |
| |
| 8198 | + | |
| 8199 | + | |
8207 | 8200 |
| |
8208 | 8201 |
| |
| 8202 | + | |
| 8203 | + | |
| 8204 | + | |
| 8205 | + | |
| 8206 | + | |
| 8207 | + | |
| 8208 | + | |
| 8209 | + | |
| 8210 | + | |
| 8211 | + | |
| 8212 | + | |
| 8213 | + | |
| 8214 | + | |
| 8215 | + | |
| 8216 | + | |
| 8217 | + | |
| 8218 | + | |
| 8219 | + | |
| 8220 | + | |
8209 | 8221 |
| |
8210 |
| - | |
8211 | 8222 |
| |
8212 | 8223 |
| |
8213 | 8224 |
| |
|
Lines changed: 47 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
420 | 420 |
| |
421 | 421 |
| |
422 | 422 |
| |
| 423 | + | |
423 | 424 |
| |
424 | 425 |
| |
425 | 426 |
| |
| |||
1298 | 1299 |
| |
1299 | 1300 |
| |
1300 | 1301 |
| |
1301 |
| - | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
1302 | 1305 |
| |
1303 | 1306 |
| |
1304 | 1307 |
| |
| |||
1347 | 1350 |
| |
1348 | 1351 |
| |
1349 | 1352 |
| |
1350 |
| - | |
| 1353 | + | |
1351 | 1354 |
| |
1352 |
| - | |
1353 |
| - | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
1354 | 1363 |
| |
1355 | 1364 |
| |
1356 | 1365 |
| |
| |||
1874 | 1883 |
| |
1875 | 1884 |
| |
1876 | 1885 |
| |
1877 |
| - | |
1878 |
| - | |
1879 |
| - | |
1880 | 1886 |
| |
1881 | 1887 |
| |
1882 |
| - | |
1883 |
| - | |
1884 |
| - | |
1885 |
| - | |
1886 |
| - | |
1887 |
| - | |
1888 |
| - | |
1889 |
| - | |
1890 |
| - | |
1891 |
| - | |
1892 |
| - | |
1893 |
| - | |
1894 |
| - | |
1895 |
| - | |
1896 |
| - | |
1897 |
| - | |
1898 |
| - | |
| 1888 | + | |
1899 | 1889 |
| |
1900 | 1890 |
| |
1901 | 1891 |
| |
| |||
9138 | 9128 |
| |
9139 | 9129 |
| |
9140 | 9130 |
| |
| 9131 | + | |
| 9132 | + | |
| 9133 | + | |
| 9134 | + | |
| 9135 | + | |
| 9136 | + | |
| 9137 | + | |
| 9138 | + | |
| 9139 | + | |
| 9140 | + | |
| 9141 | + | |
| 9142 | + | |
| 9143 | + | |
| 9144 | + | |
| 9145 | + | |
| 9146 | + | |
| 9147 | + | |
| 9148 | + | |
| 9149 | + | |
| 9150 | + | |
| 9151 | + | |
| 9152 | + | |
| 9153 | + | |
| 9154 | + | |
| 9155 | + | |
| 9156 | + | |
| 9157 | + | |
| 9158 | + | |
| 9159 | + | |
| 9160 | + | |
| 9161 | + | |
| 9162 | + | |
| 9163 | + | |
9141 | 9164 |
| |
9142 | 9165 |
| |
9143 | 9166 |
| |
|
Lines changed: 128 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1805 | 1805 |
| |
1806 | 1806 |
| |
1807 | 1807 |
| |
1808 |
| - | |
1809 |
| - | |
| 1808 | + | |
| 1809 | + | |
1810 | 1810 |
| |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
1811 | 1841 |
| |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
1812 | 1918 |
| |
1813 | 1919 |
| |
1814 | 1920 |
| |
1815 | 1921 |
| |
1816 | 1922 |
| |
| 1923 | + | |
1817 | 1924 |
| |
| 1925 | + | |
| 1926 | + | |
1818 | 1927 |
| |
1819 | 1928 |
| |
1820 | 1929 |
| |
| |||
1823 | 1932 |
| |
1824 | 1933 |
| |
1825 | 1934 |
| |
| 1935 | + | |
1826 | 1936 |
| |
| 1937 | + | |
| 1938 | + | |
1827 | 1939 |
| |
1828 | 1940 |
| |
1829 | 1941 |
| |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
1830 | 1956 |
| |
1831 | 1957 |
| |
1832 | 1958 |
| |
|
Lines changed: 30 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1252 | 1252 |
| |
1253 | 1253 |
| |
1254 | 1254 |
| |
1255 |
| - | |
1256 |
| - | |
| 1255 | + | |
| 1256 | + | |
1257 | 1257 |
| |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
1258 | 1264 |
| |
1259 | 1265 |
| |
1260 | 1266 |
| |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
1261 | 1289 |
| |
1262 | 1290 |
| |
1263 | 1291 |
| |
|
0 commit comments
Comments
(0)