postgresql/contrib/pg_buffercache/sql
Fujii Masao b70d5672d0 pg_buffercache: restore rowtype verification in pg_buffercache_pages()
Commit 257c8231bf 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 257c8231bf.

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
2026-06-10 12:32:59 +09:00
..
pg_buffercache.sql pg_buffercache: restore rowtype verification in pg_buffercache_pages() 2026-06-10 12:32:59 +09:00
pg_buffercache_numa.sql Add pg_buffercache_numa view with NUMA node info 2025-04-07 23:08:17 +02:00