This is a set of functions for doing data based partitioning in postgres.
usage
for the insert trigger
CREATE TRIGGER [partition_trigger]
BEFORE INSERT
ON [table]
FOR EACH ROW
EXECUTE PROCEDURE partition_function('[row name]','[schema name]');