forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf1ad067
committed
Sort the dependent objects before recursing in findDependentObjects().
Historically, the notices output by DROP CASCADE tended to come outin uncertain order, and in some cases you might get different claimsabout which object depends on which other one. This is because wejust traversed the dependency tree in the order in which pg_dependentries are seen, and nbtree has never promised anything about theorder of equal-keyed index entries. We've put up with that for years,hacking regression tests when necessary to prevent them from emittingunstable output. However, it's a problem for pending work that willchange nbtree's behavior for equal keys, as that causes unexpectedchanges in the regression test results.Hence, adjust findDependentObjects to sort the results of eachindexscan before processing them. The sort is on descending OID ofthe dependent objects, hence more or less reverse creation order.While this rule could still result in bogus regression test failuresif an OID wraparound occurred mid-test, that seems unlikely to happenin any plausible development or packaging-test scenario.This is enough to ensure output stability for ordinary DROP CASCADEcommands, but not for DROP OWNED BY, because that has a differentcode path with the same problem. We might later choose to sort inthe DROP OWNED BY code as well, but this patch doesn't do so.I've also not done anything about reverting the existing hacks tosuppress unstable DROP CASCADE output in specific regression tests.It might be worth undoing those, but it seems like a distinct question.The first indexscan loop in findDependentObjects is not touched,meaning there is a hazard of unstable error reports from that too.However, said hazard is not the fault of that code: it was designedon the assumption that there could be at most one "owning" objectto complain about, and that assumption does not seem unreasonable.The recent patch that added the possibility of multipleDEPENDENCY_INTERNAL_AUTO links broke that assumption, but we shouldfix that situation not band-aid around it. That's a matter foranother patch, though.Discussion:https://postgr.es/m/12244.1547854440@sss.pgh.pa.us1 parentfcea1e1 commitf1ad067
File tree
6 files changed
+98
-28
lines changed- src
- backend/catalog
- test/regress/expected
6 files changed
+98
-28
lines changedLines changed: 85 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
124 | 124 |
| |
125 | 125 |
| |
126 | 126 |
| |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
127 | 134 |
| |
128 | 135 |
| |
129 | 136 |
| |
| |||
472 | 479 |
| |
473 | 480 |
| |
474 | 481 |
| |
| 482 | + | |
| 483 | + | |
| 484 | + | |
475 | 485 |
| |
476 | 486 |
| |
477 | 487 |
| |
| |||
704 | 714 |
| |
705 | 715 |
| |
706 | 716 |
| |
707 |
| - | |
708 |
| - | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
709 | 723 |
| |
710 |
| - | |
711 |
| - | |
712 |
| - | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
713 | 728 |
| |
714 | 729 |
| |
715 | 730 |
| |
| |||
762 | 777 |
| |
763 | 778 |
| |
764 | 779 |
| |
765 |
| - | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
766 | 784 |
| |
767 | 785 |
| |
768 | 786 |
| |
| |||
798 | 816 |
| |
799 | 817 |
| |
800 | 818 |
| |
801 |
| - | |
802 |
| - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
803 | 860 |
| |
804 | 861 |
| |
805 | 862 |
| |
806 | 863 |
| |
807 | 864 |
| |
808 | 865 |
| |
809 | 866 |
| |
810 |
| - | |
| 867 | + | |
811 | 868 |
| |
812 | 869 |
| |
813 | 870 |
| |
| |||
2109 | 2166 |
| |
2110 | 2167 |
| |
2111 | 2168 |
| |
2112 |
| - | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
2113 | 2175 |
| |
2114 |
| - | |
2115 |
| - | |
2116 | 2176 |
| |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
2117 | 2184 |
| |
2118 |
| - | |
| 2185 | + | |
2119 | 2186 |
| |
2120 | 2187 |
| |
2121 | 2188 |
| |
2122 |
| - | |
2123 |
| - | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
2124 | 2194 |
| |
2125 | 2195 |
| |
2126 | 2196 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2583 | 2583 |
| |
2584 | 2584 |
| |
2585 | 2585 |
| |
2586 |
| - | |
2587 | 2586 |
| |
2588 | 2587 |
| |
2589 | 2588 |
| |
| 2589 | + | |
2590 | 2590 |
| |
2591 | 2591 |
| |
2592 | 2592 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
161 | 161 |
| |
162 | 162 |
| |
163 | 163 |
| |
164 |
| - | |
165 |
| - | |
| 164 | + | |
| 165 | + | |
166 | 166 |
| |
167 | 167 |
| |
168 | 168 |
| |
169 |
| - | |
170 |
| - | |
| 169 | + | |
| 170 | + | |
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
645 | 645 |
| |
646 | 646 |
| |
647 | 647 |
| |
648 |
| - | |
649 |
| - | |
| 648 | + | |
| 649 | + | |
650 | 650 |
| |
651 | 651 |
| |
652 | 652 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
311 | 311 |
| |
312 | 312 |
| |
313 | 313 |
| |
| 314 | + | |
| 315 | + | |
314 | 316 |
| |
315 | 317 |
| |
316 | 318 |
| |
317 | 319 |
| |
318 |
| - | |
319 |
| - | |
320 | 320 |
| |
321 | 321 |
| |
322 | 322 |
| |
| |||
327 | 327 |
| |
328 | 328 |
| |
329 | 329 |
| |
| 330 | + | |
| 331 | + | |
330 | 332 |
| |
331 | 333 |
| |
332 | 334 |
| |
333 | 335 |
| |
334 |
| - | |
335 |
| - | |
336 | 336 |
| |
337 | 337 |
| |
338 | 338 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
334 | 334 |
| |
335 | 335 |
| |
336 | 336 |
| |
| 337 | + | |
337 | 338 |
| |
338 | 339 |
| |
339 | 340 |
| |
340 | 341 |
| |
341 | 342 |
| |
342 | 343 |
| |
343 | 344 |
| |
| 345 | + | |
344 | 346 |
| |
345 | 347 |
| |
346 | 348 |
| |
347 |
| - | |
348 |
| - | |
349 | 349 |
| |
350 | 350 |
| |
351 | 351 |
| |
|
0 commit comments
Comments
(0)