Commit 3dd637f
committed
Reset relhassubclass upon attaching table as a partition
We don't allow inheritance parents as partitions, and have checks to
prevent this; but if a table _was_ in the past an inheritance parents
and all their children are removed, the pg_class.relhassubclass flag
may remain set, which confuses the partition pruning code (most
obviously, it results in an assertion failure; in production builds it
may be worse.)
Fix by resetting relhassubclass on attach.
Backpatch to all supported versions.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/18550-d5e047e9a897a889@postgresql.org1 parent 07fbecb commit 3dd637f
File tree
3 files changed
+24
-1
lines changed- src
- backend/catalog
- test/regress
- expected
- sql
3 files changed
+24
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3520 | 3520 | | |
3521 | 3521 | | |
3522 | 3522 | | |
| 3523 | + | |
| 3524 | + | |
| 3525 | + | |
| 3526 | + | |
| 3527 | + | |
| 3528 | + | |
| 3529 | + | |
| 3530 | + | |
3523 | 3531 | | |
3524 | 3532 | | |
3525 | 3533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3950 | 3950 | | |
3951 | 3951 | | |
3952 | 3952 | | |
| 3953 | + | |
| 3954 | + | |
| 3955 | + | |
| 3956 | + | |
| 3957 | + | |
| 3958 | + | |
| 3959 | + | |
| 3960 | + | |
| 3961 | + | |
3953 | 3962 | | |
3954 | | - | |
3955 | 3963 | | |
3956 | 3964 | | |
3957 | 3965 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2425 | 2425 | | |
2426 | 2426 | | |
2427 | 2427 | | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
2428 | 2435 | | |
2429 | 2436 | | |
2430 | 2437 | | |
| |||
0 commit comments