From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Jorge Torralba <jorge.torralba@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Auto create partition with declarative partitioning
Date: Mon, 22 Oct 2018 11:49:39 -0300
Message-ID: <20181022144939.hpy7zhojvos7j4cr@alvherre.pgsql> (raw)
In-Reply-To: <CACut7uSQhKPusp8Cvx-dK3huwZrRQw=aER23xs9U4fxS8-wvDA@mail.gmail.com>
On 2018-Oct-19, Jorge Torralba wrote:
> 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.
Interesting. I don't think this was ever mentioned as a possible use
case for BEFORE triggers on partitioned tables, during the pg11
development. Basically we forbade BEFORE triggers on partitioned
tables. (You can find the reasons for that in the thread that discussed
row trigger development).
> Other than creating a bunch of partitions in advance, what are my options?
Create *one* partition in advance?
Another option would be to contribute the feature of automatically
creating the partitions for Postgres 12 :-)
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: alvherre@2ndquadrant.com, jorge.torralba@gmail.com
Subject: Re: Auto create partition with declarative partitioning
In-Reply-To: <20181022144939.hpy7zhojvos7j4cr@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox