So, I threw this together last night. It's not pretty, it's not
perfect, but it works well enough. There are two files, attached,
mkstp and mktrig. Both are php programs. The first, mkstp makes
partitions. mkstp checks to see if a partition table already exists,
if it does it goes on to the next date, otherwise it creates the new
partition and (in this case) creates indexes. You can throw in grants
there as well. mktrig prints out the text needed to create the
trigger. It requires to be run something like ./mktrig | psql mydb to
work. So it's easy to see your trigger creation script. Feel free to
make it work just by hitting the db if it helps you. These scripts,
in a very similar form are working quite well for me. A third small
.sql script is included called moveit. It's designed to move data
from the parent table into its children, 100000 rows at a time.
Suggestions welcome.