Commit 7102070
committed
Don't lose partitioned table reltuples=0 after relhassubclass=f.
ANALYZE sets relhassubclass=f when a partitioned table no longer has
partitions. An ANALYZE doing that proceeded to apply the inplace update
of pg_class.reltuples to the old pg_class tuple instead of the new
tuple, losing that reltuples=0 change if the ANALYZE committed.
Non-partitioning inheritance trees were unaffected. Back-patch to v14,
where commit 375aed3 introduced
maintenance of partitioned table pg_class.reltuples.
Reported by Alexander Lakhin.
Discussion: https://postgr.es/m/a295b499-dcab-6a99-c06e-01cf60593344@gmail.com1 parent 055891f commit 7102070Copy full SHA for 7102070
File tree
Expand file treeCollapse file tree
3 files changed
+82
-1
lines changedOpen diff view settings
Filter options
- src
- backend/commands
- test/regress
- expected
- sql
Expand file treeCollapse file tree
3 files changed
+82
-1
lines changedOpen diff view settings
Collapse file
src/backend/commands/analyze.c
Copy file name to clipboardExpand all lines: src/backend/commands/analyze.c+6-1Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
629 | 629 | |
630 | 630 | |
631 | 631 | |
632 | | - |
| 632 | + |
| 633 | + |
| 634 | + |
| 635 | + |
| 636 | + |
633 | 637 | |
634 | 638 | |
635 | 639 | |
| ||
664 | 668 | |
665 | 669 | |
666 | 670 | |
| 671 | + |
667 | 672 | |
668 | 673 | |
669 | 674 | |
|
Collapse file
src/test/regress/expected/vacuum.out
Copy file name to clipboardExpand all lines: src/test/regress/expected/vacuum.out+47Lines changed: 47 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
82 | 82 | |
83 | 83 | |
84 | 84 | |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
85 | 132 | |
86 | 133 | |
87 | 134 | |
|
Collapse file
src/test/regress/sql/vacuum.sql
Copy file name to clipboardExpand all lines: src/test/regress/sql/vacuum.sql+29Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
67 | 67 | |
68 | 68 | |
69 | 69 | |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
| 98 | + |
70 | 99 | |
71 | 100 | |
72 | 101 | |
|
0 commit comments