forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2edfc02
committed
Fix dependency searching for case where column is visited before table.
When the recursive search in dependency.c visits a column and then latervisits the whole table containing the column, it needs to propagate thedrop-context flags for the table to the existing target-object entry forthe column. Otherwise we might refuse the DROP (if not CASCADE) on theincorrect grounds that there was no automatic drop pathway to the column.Remarkably, this has not been reported before, though it's possible atleast when an extension creates both a datatype and a table using thatdatatype.Rather than just marking the column as allowed to be dropped, it mightseem good to skip the DROP COLUMN step altogether, since the later DROPof the table will surely get the job done. The problem with that is thatthe datatype would then be dropped before the table (since the wholesituation occurred because we visited the datatype, and then recursed tothe dependent column, before visiting the table). That seems pretty risky,and the case is rare enough that it doesn't seem worth expending a lot ofeffort or risk to make the drops happen in a safe order. So we just playdumb and delete the column separately according to the existing dropordering rules.Per report from Petr Jelinek, though this is different from his proposedpatch.Back-patch to 9.1, where extensions were introduced. There's currentlyno evidence that such cases can arise before 9.1, and in any case we wouldalso need to back-patchcb5c2ba to 9.0if we wanted to back-patch this.1 parent1871c89 commit2edfc02
1 file changed
+56
-18
lines changedLines changed: 56 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
246 | 246 |
| |
247 | 247 |
| |
248 | 248 |
| |
249 |
| - | |
| 249 | + | |
250 | 250 |
| |
251 | 251 |
| |
252 | 252 |
| |
| |||
2116 | 2116 |
| |
2117 | 2117 |
| |
2118 | 2118 |
| |
| 2119 | + | |
2119 | 2120 |
| |
2120 | 2121 |
| |
2121 | 2122 |
| |
| |||
2130 | 2131 |
| |
2131 | 2132 |
| |
2132 | 2133 |
| |
2133 |
| - | |
| 2134 | + | |
2134 | 2135 |
| |
2135 |
| - | |
| 2136 | + | |
2136 | 2137 |
| |
2137 | 2138 |
| |
2138 | 2139 |
| |
2139 | 2140 |
| |
2140 |
| - | |
2141 |
| - | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
2142 | 2144 |
| |
2143 |
| - | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
2144 | 2171 |
| |
2145 | 2172 |
| |
2146 | 2173 |
| |
2147 | 2174 |
| |
2148 |
| - | |
| 2175 | + | |
2149 | 2176 |
| |
2150 | 2177 |
| |
2151 | 2178 |
| |
| |||
2156 | 2183 |
| |
2157 | 2184 |
| |
2158 | 2185 |
| |
| 2186 | + | |
2159 | 2187 |
| |
2160 | 2188 |
| |
2161 | 2189 |
| |
| |||
2168 | 2196 |
| |
2169 | 2197 |
| |
2170 | 2198 |
| |
2171 |
| - | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
2172 | 2219 |
| |
2173 |
| - | |
2174 |
| - | |
2175 |
| - | |
2176 |
| - | |
2177 |
| - | |
2178 |
| - | |
2179 |
| - | |
2180 |
| - | |
2181 |
| - | |
2182 | 2220 |
| |
2183 | 2221 |
| |
2184 | 2222 |
| |
2185 |
| - | |
| 2223 | + | |
2186 | 2224 |
| |
2187 | 2225 |
| |
2188 | 2226 |
| |
|
0 commit comments
Comments
(0)