pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Albe Laurenz <laurenz.albe@wien.gv.at>
Cc: roopasatish *EXTERN* <roopabenzer@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: probelm with alter table add constraint......
Date: Mon, 06 Apr 2009 09:54:00 -0400
Message-ID: <27085.1239026040@sss.pgh.pa.us> (raw)
In-Reply-To: <D960CB61B694CF459DCFB4B0128514C202FF6545@exadv11.host.magwien.gv.at>
References: <5da3d2700904052354g61f02031x822322e9ee512ad9@mail.gmail.com>
	<D960CB61B694CF459DCFB4B0128514C202FF6545@exadv11.host.magwien.gv.at>

"Albe Laurenz" <laurenz.albe@wien.gv.at> writes:
> roopasatish wrote:
>> I have an issue with the add foreign key constraint which 
>> goes for waiting and locks other queries as well.
>> 
>> ALTER TABLE ONLY holding_positions ADD CONSTRAINT 
>> holding_positions_stock_id_fkey FOREIGN KEY (stock_id)
>> REFERENCES stocks (stock_id) MATCH SIMPLE
>> ON UPDATE NO ACTION ON DELETE NO ACTION;
>> 
>> The holding_positions table has no data in it as yet.

> Look in pg_catalog.pg_locks for a second transaction that
> holds a lock on the table holding_positions.

This statement also needs to get lock on the referenced table "stocks".
An open transaction that's referenced either table will block it.

			regards, tom lane



view thread (5+ messages)  latest in thread

Message-ID: <27085.1239026040@sss.pgh.pa.us>
Permalink:  ../27085.1239026040@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/27085.1239026040@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, laurenz.albe@wien.gv.at, roopabenzer@gmail.com
  Subject: Re: probelm with alter table add constraint......
  In-Reply-To: <27085.1239026040@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox