Auto create partition with declarative partitioning - Mailing list pgsql-admin

From Jorge Torralba
Subject Auto create partition with declarative partitioning
Date
Msg-id CACut7uSQhKPusp8Cvx-dK3huwZrRQw=aER23xs9U4fxS8-wvDA@mail.gmail.com
Whole thread Raw
Responses Re: Auto create partition with declarative partitioning
Re: Auto create partition with declarative partitioning
List pgsql-admin
Trying to make this work but am having difficulties.

I have created a table with a timestamp column that i wish to partition by range using the timestamp column.

My objective is to test if a partition exists for the date range and create it if it does not.

In the past I have had a before insert trigger which I would send to a create partition function. Extract the info from NEW.createdate, and use some logic to create the partition if it did not exists for the create date.

However, now, with the partition by range, I get the error : 

Partitioned tables cannot have BEFORE / FOR EACH ROW triggers.

Therefore I cannot call the function to check if the partition exists.

Other than creating a bunch of partitions in advance, what are my options?

--
Thanks,

Jorge Torralba
----------------------------

Note: This communication may contain privileged or other confidential information. If you are not the intended recipient, please do not print, copy, retransmit, disseminate or otherwise use the information. Please indicate to the sender that you have received this email in error and delete the copy you received. Thank You.

pgsql-admin by date:

Previous
From: prasanna rk
Date:
Subject: Re: minimal network speed for replication
Next
From: Scott Ribe
Date:
Subject: Re: Auto create partition with declarative partitioning