forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit58b1362
committed
Fix order of operations in CREATE OR REPLACE VIEW.
When CREATE OR REPLACE VIEW acts on an existing view, don't update theview options until after the view query has been updated.This is necessary in the case where CREATE OR REPLACE VIEW is used onan existing view that is not updatable, and the new view is updatableand specifies the WITH CHECK OPTION. In this case, attempting to applythe new options to the view before updating its query fails, becausethe options are applied using the ALTER TABLE infrastructure whichchecks that WITH CHECK OPTION is only applied to an updatable view.If new columns are being added to the view, that is also done usingthe ALTER TABLE infrastructure, but it is important that that still bedone before updating the view query, because the rules system checksthat the query columns match those on the view relation. Added acomment to explain that, in case someone is tempted to move that towhere the view options are now being set.Back-patch to 9.4 where WITH CHECK OPTION was added.Report:https://postgr.es/m/CAEZATCUp%3Dz%3Ds4SzZjr14bfct_bdJNwMPi-gFi3Xc5k1ntbsAgQ%40mail.gmail.com1 parentcd510f0 commit58b1362
File tree
3 files changed
+76
-29
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+76
-29
lines changedLines changed: 49 additions & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
59 | 59 |
| |
60 | 60 |
| |
61 | 61 |
| |
62 |
| - | |
63 |
| - | |
64 |
| - | |
65 |
| - | |
| 62 | + | |
| 63 | + | |
66 | 64 |
| |
67 | 65 |
| |
68 | 66 |
| |
69 | 67 |
| |
70 |
| - | |
| 68 | + | |
71 | 69 |
| |
72 | 70 |
| |
73 | 71 |
| |
| |||
161 | 159 |
| |
162 | 160 |
| |
163 | 161 |
| |
164 |
| - | |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 |
| - | |
169 |
| - | |
170 |
| - | |
171 |
| - | |
172 |
| - | |
173 | 162 |
| |
174 | 163 |
| |
175 | 164 |
| |
176 | 165 |
| |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
177 | 170 |
| |
178 | 171 |
| |
179 | 172 |
| |
| |||
192 | 185 |
| |
193 | 186 |
| |
194 | 187 |
| |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
195 | 193 |
| |
196 | 194 |
| |
197 |
| - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
198 | 220 |
| |
199 | 221 |
| |
200 | 222 |
| |
| |||
211 | 233 |
| |
212 | 234 |
| |
213 | 235 |
| |
214 |
| - | |
| 236 | + | |
215 | 237 |
| |
216 | 238 |
| |
217 | 239 |
| |
| |||
224 | 246 |
| |
225 | 247 |
| |
226 | 248 |
| |
227 |
| - | |
228 |
| - | |
229 |
| - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
230 | 252 |
| |
231 | 253 |
| |
232 | 254 |
| |
233 | 255 |
| |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
234 | 263 |
| |
235 | 264 |
| |
236 | 265 |
| |
| |||
530 | 559 |
| |
531 | 560 |
| |
532 | 561 |
| |
533 |
| - | |
534 |
| - | |
535 |
| - | |
536 |
| - | |
537 |
| - | |
538 |
| - | |
539 |
| - | |
540 |
| - | |
541 |
| - | |
542 |
| - | |
| 562 | + | |
543 | 563 |
| |
544 | 564 |
| |
545 | 565 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2452 | 2452 |
| |
2453 | 2453 |
| |
2454 | 2454 |
| |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + |
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1098 | 1098 |
| |
1099 | 1099 |
| |
1100 | 1100 |
| |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + |
0 commit comments
Comments
(0)