pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Virendra Kumar <viru_7683@yahoo.com>
To: Pgsql-general General <pgsql-general@postgresql.org>
Subject: Different Lock Behavior With Create and Drop Foreign Key
Date: Fri, 10 Apr 2020 01:40:52 +0000 (UTC)
Message-ID: <834603375.3470346.1586482852542@mail.yahoo.com> (raw)
References: <834603375.3470346.1586482852542.ref@mail.yahoo.com>

Hi Team,
Here is test case.----create table testx
(
    v_code character varying(32),
    client_id bigint
);
alter table testx add constraint testx_pkey primary key (v_code);

create table testy
(
    dxid bigint,
    v_code character varying(32)
);
alter table testy add constraint testy_pkey primary key (dxid);create index on testy (v_code);

Let's begin two session, in session1 I am going begin a transaction and run select on parent table:
Session1----begin;select * from testx;

On another session let's call session2, I am running create FK on second table
Session2--- alter table testy add constraint testy_fkey foreign key (v_code) references testx(v_code); <--This works.alter table testy drop constraint testy_fkey; <--Hangs


Regards,Virendra Kumar

view thread (3+ messages)  latest in thread

Message-ID: <834603375.3470346.1586482852542@mail.yahoo.com>
Permalink:  ../834603375.3470346.1586482852542@mail.yahoo.com/
Also on:    postgresql.org/message-id/834603375.3470346.1586482852542@mail.yahoo.com

 · 

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-general@postgresql.org
  Cc: viru_7683@yahoo.com
  Subject: Re: Different Lock Behavior With Create and Drop Foreign Key
  In-Reply-To: <834603375.3470346.1586482852542@mail.yahoo.com>

* 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