- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit5ad0337
committed
Disallow converting an inheritance child table to a view.
Generally, members of inheritance trees must be plain tables (or,in more recent versions, foreign tables). ALTER TABLE INHERITrejects creating an inheritance relationship that has a view ateither end. When DefineQueryRewrite attempts to convert a relationto a view, it already had checks prohibiting doing so for partitioningparents or children as well as traditional-inheritance parents ...but it neglected to check that a traditional-inheritance child wasn'tbeing converted. Since the planner assumes that any inheritancechild is a table, this led to making plans that tried to do a physicalscan on a view, causing failures (or even crashes, in recent versions).One could imagine trying to support such a case by expanding the viewnormally, but since the rewriter runs before the planner doesinheritance expansion, it would take some very fundamental refactoringto make that possible. There are probably a lot of other parts of thesystem that don't cope well with such a situation, too. For now,just forbid it.Per bug #16856 from Yang Lin. Back-patch to all supported branches.(In versions before v10, this includes back-patching the portion ofcommit501ed02 that added has_superclass(). Perhaps the lack ofthat infrastructure partially explains the missing check.)Discussion:https://postgr.es/m/16856-0363e05c6e1612fd@postgresql.org1 parentaaf2661 commit5ad0337
File tree
5 files changed
+62
-6
lines changed- src
- backend
- catalog
- rewrite
- include/catalog
- test/regress
- expected
- sql
5 files changed
+62
-6
lines changedLines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
254 | 254 |
| |
255 | 255 |
| |
256 | 256 |
| |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
257 | 283 |
| |
258 | 284 |
| |
259 | 285 |
| |
|
Lines changed: 13 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
| 28 | + | |
28 | 29 |
| |
29 | 30 |
| |
30 | 31 |
| |
| |||
411 | 412 |
| |
412 | 413 |
| |
413 | 414 |
| |
414 |
| - | |
415 |
| - | |
416 |
| - | |
417 |
| - | |
418 |
| - | |
419 |
| - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
420 | 421 |
| |
421 | 422 |
| |
422 | 423 |
| |
| |||
453 | 454 |
| |
454 | 455 |
| |
455 | 456 |
| |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
456 | 463 |
| |
457 | 464 |
| |
458 | 465 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
| 24 | + | |
24 | 25 |
| |
25 | 26 |
| |
26 | 27 |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2457 | 2457 |
| |
2458 | 2458 |
| |
2459 | 2459 |
| |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
2460 | 2471 |
| |
2461 | 2472 |
| |
2462 | 2473 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
898 | 898 |
| |
899 | 899 |
| |
900 | 900 |
| |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
901 | 912 |
| |
902 | 913 |
| |
903 | 914 |
| |
|
0 commit comments
Comments
(0)