Re: Auto create partition with declarative partitioning

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Auto create partition with declarative partitioning
Дата
Msg-id 20181022144939.hpy7zhojvos7j4cr@alvherre.pgsql
обсуждение исходный текст
Ответ на Auto create partition with declarative partitioning  (Jorge Torralba <jorge.torralba@gmail.com>)
Список pgsql-admin
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


В списке pgsql-admin по дате отправления:

Предыдущее
От: prasanna rk
Дата:
Сообщение: Re: minimal network speed for replication
Следующее
От: pavan95
Дата:
Сообщение: Re: Point in time Recovery in Postgres?