ALTER TABLE ... DISABLE TRIGGER vs. AccessExclusiveLock

From: James Robinson <jlrobins(at)socialserve(dot)com>
To: Hackers Development <pgsql-hackers(at)postgresql(dot)org>
Subject: ALTER TABLE ... DISABLE TRIGGER vs. AccessExclusiveLock
Date: 2010-07-27 19:07:28
Message-ID: 3A53054C-E654-4E18-9F5E-07B313029910@socialserve.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

Experience and a read through backend/commands/tablecmds.c's
AlterTable() indicate that ALTER TABLE ... DISABLE TRIGGER obtains an
exclusive lock on the table (as does any ALTER TABLE).

Blocking other readers from a table when we've, within the body of a
transaction performing a bulk update operation where we don't want /
need triggers to fire, seems at first glance to be over-kill. I can
see how AlterTable()'s complex logic is made less complex through 'get
and keep a big lock', since most of its operational modes really do
need exclusive access, but is it strictly required for ... DISABLE /
REENABLE TRIGGER?

Could, say, RowExclusiveLock hypothetically provide adequate
protection, allowing concurrent reads, but blocking out any other
writers (for ENABLE / DISABLE TRIGGER) -- such as if driven through a
new statement other than ALTER TABLE -- such as "DISABLE TRIGGER foo
ON tbar" ?

Thanks!
----
James Robinson
Socialserve.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-07-27 19:17:29 Re: git config user.email
Previous Message Andrew Dunstan 2010-07-27 18:36:21 Re: PostGIS vs. PGXS in 9.0beta3