

L_schema_name || '.' || l_table_name AS parent_table L_retention_days + l_pre_days AS total_days, SELECT l_retention_days AS retention_days, breaks the naming pattern or, better yet, manually detached from the parent table beyond the retention schedule then they either need to be renamed in such fashion that NB: in the event that there are ever any partitions that are desired to be preserved ASSERTION: the table partitions reside in the same schema as the parent table ASSERTION: there are no other partitioned tables in the schema that have a similar name ASSERTION: the schema name and table name of the partioned table do not require quoting the logging functionality can continue to work. event that this function is not run for a few days, The intent is to maintain a buffer so that, in the

L_pre_days integer := 10 - The number of future days to pre-create partitions for. L_retention_days integer := 30 - The number of past days to retain partitions for. L_table_name varchar := 'TABLE_NAME' - The name of the table to manage partitions for L_schema_name varchar := 'SCHEMA_NAME' - The name of the schema for the partitioned table Procedure manage_partitions creates (and disposes of) table partitions I've been using the (slightly edited) following and running it on a daily cron: CREATE OR REPLACE FUNCTION manage_partitions () As note by others, PostgreSQL doesn't have any built in functionality for automatically doing this.
