Re: why dropping a trigger may cause a deadlock

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: why dropping a trigger may cause a deadlock
Date: 2009-06-05 21:35:19
Message-ID: 13035.1244237719@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it> writes:
> I don't get it.
> Why dropping the triggers would cause a deadlock anyway?

> I bet it is due to my nave view of the problem but I think a
> trigger is a "function". Unless there is concurrent access to the
> table where the function is defined... I can't see why dropping the
> "functions" serially should cause a lock.

They're not just functions, they are part of the DDL for a table.
Adding or removing a trigger on a table requires exclusive lock
on that table, otherwise you can't be sure what will happen in
concurrent transactions that might (or might not) be supposed to
fire the trigger.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua Tolley 2009-06-05 21:45:33 Re: Using results from DELETE ... RETURNING
Previous Message Atul Chojar 2009-06-05 21:17:04 Re: How to automatically propagate new/changed database functions from one database to another