postgresql – Monitor FOR loop progress in postgres


I have a Postgres loop as follows, which I am running from the command line via psql:

DO
$do$
BEGIN 
   FOR i IN 1..20000
   -- update some rows
   LOOP
END LOOP;
END; 
$do$;

Is there any way to access the value of the counter i to track the progress of the loop? I’ve looked in the pgAdmin dashboard with no success.