How to invoke OOM killer for pg process? Some easy "hack" for test purpose.
For most purposes, you can just pick a backend process ID, and send it a `kill -9`. From the PostgreSQL perspective, that is just what the OOM killer does.
If it needs to happen 'naturally', you could do something like:
set work_mem=50GB;
select * from generate_series(1,100000000) order by random();
Where the numbers may need to be adjusted based on your RAM.