Partitioning: CREATE OR REPLACE RULE freezes. - Mailing list pgsql-general

From Gene
Subject Partitioning: CREATE OR REPLACE RULE freezes.
Date
Msg-id 430d92a20607291159y4dd29fbfxf7820d1ca5569928@mail.gmail.com
Whole thread Raw
List pgsql-general
I have created a function that I use to help automate the creation of
partition tables. Basically it:

1. Creates a new table inherited from the parent table (which is empty)
2. creates or replaces a sole rule on the parent table to insert into
the new table:

EXECUTE 'CREATE OR REPLACE RULE parent_insert_rule AS ON INSERT TO parent'
            || ' DO INSTEAD '
            || ' INSERT INTO ' || new_child_table;

3. Update constraints on last child table and new one for constraint exclusion.

It seems to work if I run it once or if I stop all inserts/updates to
the parent table. If I run it a second time it freezes during the
create or replace rule step. The parent table receives about 10
inserts per second so it must be some sort of deadlock but I don't
know where to start to fix the problem. I've tried locking the entire
table but that didn't seem to help. Any suggestions would be greatly
appreciated. I would prefer not to have to stop everything just to
create a new partition table.

Thanks,
--
Eugene Hart

pgsql-general by date:

Previous
From: Habib Seifzadeh
Date:
Subject: Auto Installation
Next
From: Peter Eisentraut
Date:
Subject: Re: Auto Installation