Clean up a couple of ad-hoc computations of the maximum number of tuples
Tom Lane <tgl@sss.pgh.pa.us>
Clean up a couple of ad-hoc computations of the maximum number of tuples on a page, as suggested by ITAGAKI Takahiro. Also, change a few places that were using some other estimates of max-items-per-page to consistently use MaxOffsetNumber. This is conservatively large --- we could have used the new MaxHeapTuplesPerPage macro, or a similar one for index tuples --- but those places are simply declaring a fixed-size buffer and assuming it will work, rather than actively testing for overrun. It seems safer to size these buffers in a way that can't overflow even if the page is corrupt.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/gist/gistvacuum.c | modified | +3 −3 |
| src/backend/access/nbtree/nbtree.c | modified | +2 −2 |
| src/backend/commands/vacuum.c | modified | +3 −3 |
| src/backend/commands/vacuumlazy.c | modified | +4 −7 |
| src/backend/nodes/tidbitmap.c | modified | +2 −2 |
| src/include/access/htup.h | modified | +11 −1 |