Обсуждение: create table problems

Поиск
Список
Период
Сортировка

create table problems

От
"Chris Hoover"
Дата:
  I am trying to create a table in my production system that has a foreign key into an existing table.  However, this action is being blocked by transactions on that table, and is blocking any additional selects on that table.

Why is this?  The table is empty (being a create), so I don't understand what Postgresql is trying to do.

Thanks,

Chris
PG 8.1.3

Re: create table problems

От
Michael Fuhr
Дата:
On Wed, Jul 26, 2006 at 04:51:34PM -0400, Chris Hoover wrote:
>  I am trying to create a table in my production system that has a foreign
> key into an existing table.  However, this action is being blocked by
> transactions on that table, and is blocking any additional selects on that
> table.
>
> Why is this?  The table is empty (being a create), so I don't understand
> what Postgresql is trying to do.

The transaction that's creating the new table wants to acquire an
AccessExclusiveLock on the referenced table, presumably so it can
alter that table to add referential integrity triggers.  The
referenced table needs to have such triggers so it knows what
integrity checks to make when somebody tries to update or delete
its rows.  Maybe one of the developers will confirm or refute.

--
Michael Fuhr