-
Notifications
You must be signed in to change notification settings - Fork 69
Description
I have a generic trigger function that I need to apply on all tables, from parent until any new child table (which must be monthly created). This function just fill one column of the set with some needed information.
If I do all partitioning creation and management, I am able to apply this trigger function to any new child table being created by the (manually wrote) triggers and scripts that handle and maintain my partition schema.
But if I use pg_pathman, for all features this module provide (which I am happy to use), I am unable to get PostgreSQL to inherit the trigger function... I know that PostgreSQL does not provide trigger inheritance but I was waiting pg_pathman could handle that, since this module does copy and properly apply other stuffs like constraints, foreign keys, indexes and so on.
I have been trying some workaround to detect when the new child table is created but even if I get something close to the goal, it won't work because the new child table is created on demand by pg_pathman, exactly when the source row is getting inserted... so, any trigger function I could be able to apply to the new child table won't work at all for the first row that produce the child table creation... you know, pg_pathman create the child table and insert the row automatically and my implementation will be executed too late for the first row (or set of rows) being inserted.
It is clear that for the next rows being inserted in this child table after the trigger function get applied, all them will be processed fine by the trigger function but first ones won't.
So, is there a possibility you could add something in the partitions definition options to say which trigger function we would like to apply to each new child table?
Or, is there something I could do by myself to handle this and complement the pg_pathman work?
Thanks in advance,