postgres存储过程
-- DROP FUNCTION IF EXISTS bulk_del_tables();
CREATE FUNCTION bulk_del_tables(tables varchar(256))
RETURNS void AS $$
DECLARE names CURSOR FOR
SELECT tablename FROM pg_tables WHERE tablename LIKE '%' || tables || '%' ;
BEGIN
FOR stmt IN names LOOP
EXECUTE 'DROP TABLE '|| quote_ident(stmt.tablename) || ' CASCADE;';
END LOOP;
END;
$$ LANGUAGE plpgsql;
https://www.cnblogs.com/ios9/p/16055797.html