Hello, I'm trying to build a set of plpgsql functions in order to ease partitioning by date, let's say one table per day for a total of 30 days. I have plpgsql functions to create the partition tables (having a date suffix) and to manage a retention period, however I still need to solve a problem with indexes/foreign keys. The partition tables are inherited from a template table, and while inheriting I loose the information on indexes/keys. One possibility would be to write a facility to execute a set of ddl statements on all the partition tables using a template (e.g. using a placeholder for the table name) or maybe one could use the information on Primary/foreign keys and indexes present also in the system tables so I guess one should be able to use it to build the PK/FKs and indexes on the partition tables. Any advice? Thanks in advance, Enrico Sirola |