        and t.tablename ~ ('^'|| _table || _expr ||'$')
        and t.tablename < _table || to_char (now() - i_retention_period, _dfmt)
   loop
+    raise notice 'DROP TABLE %', _part;
     execute 'drop table '|| _part;
-    return next _part;
   end loop;
 end;
 $$ language plpgsql;

    raise exception 'not supported i_partition_period: %', i_partition_period;
  end if;

  for _part in
    select quote_ident (t.schemaname) ||'.'|| quote_ident (t.tablename)
      from pg_catalog.pg_tables t

--    i_parent_table        Master table from which partitions are inherited
--    i_retention_period    How long to keep partitions around
--    i_partition_period    One of: year, month, day, hour
-------------------------------------------------------------------------------
declare
  _schema text not null := lower (split_part (i_parent_table, '.', 1));
