pg_buffercache: restore rowtype verification in pg_buffercache_pages()
Fujii Masao <fujii@postgresql.org>
pg_buffercache: restore rowtype verification in pg_buffercache_pages() Commit 257c8231bf9 changed pg_buffercache_pages() to materialize its output directly into a tuplestore. As a result, the function ended up trusting a caller-supplied RECORD descriptors. That could lead to crashes if the supplied row definition did not match the actual returned values, for example by passing bool Datums to tuplestore_putvalues() with an incompatible descriptor. Fix this by constructing the correct tuple descriptor for pg_buffercache_pages() and assigning it to rsinfo->setDesc after InitMaterializedSRF(). This restores the executor's tupledesc_match() verification, so incompatible caller-supplied row definitions are rejected with an error, as before commit 257c8231bf9. Bug: #19508 Reported-by: Nikita Kalinin <n.kalinin@postgrespro.ru> Author: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com> Discussion: https://postgr.es/m/19508-e5f188183279219b@postgresql.org
Files
| Path | Change | +/− |
|---|---|---|
| contrib/pg_buffercache/expected/pg_buffercache.out | modified | +8 −0 |
| contrib/pg_buffercache/pg_buffercache_pages.c | modified | +51 −0 |
| contrib/pg_buffercache/sql/pg_buffercache.sql | modified | +6 −0 |
Discussion
- BUG #19508: pg_buffercache_pages() crashes the backend with an incompatible caller-supplied record definition 10 messages · 2026-06-04 → 2026-06-10