copying indexes and f.keys from a template table - Mailing list pgsql-general

From Enrico Sirola
Subject copying indexes and f.keys from a template table
Date
Msg-id 2B2C0810-C67D-4759-A79B-8EFE2559BF4E@gmail.com
Whole thread Raw
List pgsql-general
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,

pgsql-general by date:

Previous
From: Sean Davis
Date:
Subject: Re: [NOVICE] Recursive relationship - preventing cross-index entries.
Next
From: "Rhys Stewart"
Date:
Subject: Re: regexp searching in arrays not working?