On Sat, Jul 1, 2023 at 6:09 AM Thomas Munro <thomas.mu...@gmail.com> wrote: > > > It should be restricted by role, but I wonder which role it should be. > Testing for superuser is now out of fashion. >
as pg_buffercache/pg_buffercache--1.2--1.3.sql. You need pg_maintain privilege to use pg_buffercache. The following query works on a single user. Obviously you need a role who can gain pg_monitor privilege. begin; create role test login nosuperuser; grant select, insert on onek to test; grant pg_monitor to test; set role test; select count(*) from onek; insert into onek values(default); (SELECT count(*) FROM pg_buffercache WHERE relfilenode = pg_relation_filenode('onek'::regclass)) except ( select count(pg_buffercache_invalidate(bufferid)) from pg_buffercache where relfilenode = pg_relation_filenode('onek'::regclass) ); rollback;