This might be off-topic, but...
I've found ExecutorLimit() (in executor/execMain.c) is useful for me
especially when issuing an ad-hock query via psql. I personally use
the function with customized set command.
set query_limit to 'num';
limit the max number of results returned by the backend
show query_limit;
display the current query limit
reset query_limit;
disable the query limit (unlimited number of results allowed)
--
Tatsuo Ishii
t-ishii@sra.co.jp