Race condition while creating a new partition

Поиск
Список
Период
Сортировка
От Andrei Zhidenkov
Тема Race condition while creating a new partition
Дата
Msg-id FDFDBCC0-3AC5-44A7-A69F-D607CBA5A662@n26.com
обсуждение исходный текст
Ответы Re: Race condition while creating a new partition
Список pgsql-general
We use this code in order to automatically create new partitions for a partitioned table (Postgres 10.6):

begin
  insert into <partitioned_table>;
exception when undefined_table then
  begin
    <create_unexistent_partition>
    -- A concurrent txn has created the new partition
    exception when others then end;
    -- Insert data into the new partition
    insert into <partitioned_table>;
  end;
end;

As far as I understand we should always have a new partition created either in current or in concurrent transaction but
todaywe faced the problem when we failed to insert data due to a partition nonexistence for a small period of time.
HaveI missed something? 

Thank you.

—

With best regards, Andrei Zhidenkov.


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

Предыдущее
От: Arup Rakshit
Дата:
Сообщение: Create array of data from JSONB in PG 9.5
Следующее
От: PegoraroF10
Дата:
Сообщение: naming triggers for execution