Search Postgresql Archives

Race condition while creating a new partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 today we faced the problem when we failed to insert data due to a partition nonexistence for a small period of time. Have I missed something?

Thank you.

—

With best regards, Andrei Zhidenkov.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux