DROP TABLE master_tbl;

DO $$
DECLARE
    i INT;
    child_name CHAR(2);

BEGIN
    FOR i IN 1..40 LOOP

    child_name := to_char(i, 'fm00');
    EXECUTE 'DROP TABLE child_tbl' || child_name;

    END LOOP;
END;
$$ LANGUAGE plpgsql;
