Re: [HACKERS] ALTER TABLE deadlock with concurrent INSERT

2011-03-04 Thread Joe Conway
On 03/03/2011 11:36 PM, Noah Misch wrote: Does relation 16902 (attribute_summary) have a foreign key constraint over the sequence_number column, in either direction, with relation 16896? That would explain it: session 1: ALTER TABLE attribute_summary ... sleeps after relation_openrv in

Re: [HACKERS] ALTER TABLE deadlock with concurrent INSERT

2011-03-03 Thread Jim Nasby
On Mar 2, 2011, at 2:54 PM, Joe Conway wrote: On 03/02/2011 12:41 PM, Tom Lane wrote: Looks like the process trying to do the ALTER has already got some lower-level lock on the table. It evidently hasn't got AccessExclusiveLock, but nonetheless has something strong enough to block an INSERT,

Re: [HACKERS] ALTER TABLE deadlock with concurrent INSERT

2011-03-03 Thread Joe Conway
On 03/03/2011 03:49 PM, Jim Nasby wrote: On Mar 2, 2011, at 2:54 PM, Joe Conway wrote: On 03/02/2011 12:41 PM, Tom Lane wrote: Looks like the process trying to do the ALTER has already got some lower-level lock on the table. It evidently hasn't got AccessExclusiveLock, but nonetheless has

Re: [HACKERS] ALTER TABLE deadlock with concurrent INSERT

2011-03-03 Thread Jim Nasby
On Mar 3, 2011, at 6:26 PM, Joe Conway wrote: On 03/03/2011 03:49 PM, Jim Nasby wrote: On Mar 2, 2011, at 2:54 PM, Joe Conway wrote: On 03/02/2011 12:41 PM, Tom Lane wrote: Looks like the process trying to do the ALTER has already got some lower-level lock on the table. It evidently hasn't

Re: [HACKERS] ALTER TABLE deadlock with concurrent INSERT

2011-03-03 Thread Noah Misch
On Wed, Mar 02, 2011 at 12:25:16PM -0800, Joe Conway wrote: I'm working with a client on an application upgrade script which executes a function to conditionally do an: ALTER TABLE foo ALTER COLUMN bar SET DATA TYPE baz If this is run while the application is concurrently doing inserts

[HACKERS] ALTER TABLE deadlock with concurrent INSERT

2011-03-02 Thread Joe Conway
I'm working with a client on an application upgrade script which executes a function to conditionally do an: ALTER TABLE foo ALTER COLUMN bar SET DATA TYPE baz If this is run while the application is concurrently doing inserts into foo, we are occasionally seeing deadlocks. Aside from the fact

Re: [HACKERS] ALTER TABLE deadlock with concurrent INSERT

2011-03-02 Thread Tom Lane
Joe Conway m...@joeconway.com writes: I'm working with a client on an application upgrade script which executes a function to conditionally do an: ALTER TABLE foo ALTER COLUMN bar SET DATA TYPE baz If this is run while the application is concurrently doing inserts into foo, we are

Re: [HACKERS] ALTER TABLE deadlock with concurrent INSERT

2011-03-02 Thread Joe Conway
On 03/02/2011 12:41 PM, Tom Lane wrote: Looks like the process trying to do the ALTER has already got some lower-level lock on the table. It evidently hasn't got AccessExclusiveLock, but nonetheless has something strong enough to block an INSERT, such as ShareLock. Hmmm, is it possible that