CREATE OR REPLACE FUNCTION generate_tables(n int) RETURNS void LANGUAGE plpgsql
AS $body$
DECLARE
    i int;
    qry varchar;
BEGIN
	FOR i IN 1..n LOOP
	    qry = 'CREATE TABLE test_table_with_len_63_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaax' || to_char(i, 'FM000') || ' (i int)';
		RAISE NOTICE 'Executing: %', qry;
		EXECUTE qry;
	END LOOP;
END;
$body$;

SELECT generate_tables(100);
