Save this script as do_populate_results.sql.

do $body$
declare
  nof_buckets constant int not null := 20;
begin
  delete from results;
  call do_ntile        (nof_buckets);
  call do_percent_rank (nof_buckets);
  call do_cume_dist    (nof_buckets);
end;
$body$;