For a migration I have automatically built scripts containing anonymous blocks for every entity to update and keep a log table for the results.
DO $$
DECLARE productId varchar;
BEGIN
productId := getProductId('9783980493017');
update product set ...;
...
EXCEPTION
WHEN OTHERS THEN
insert into mig_messages(createddate,identifier,message)
values(now(), '9783980493017', SQLERRM);
END $$;
This works fine so far. But when I run these scripts with psql every DO
is printed on the prompt. This sounds a bit silly, but there are lots of scripts with lots of product update blocks in it (about 5 millions or more). How can I suppress this output without redirecting it completely to /dev/null or switching psql to silent? At last there MAY be some output I want to see (errors, warnings etc.).