Re: [HACKERS] FOREIGN KEY and shift/reduce

From: wieck(at)debis(dot)com (Jan Wieck)
To: Inoue(at)tpf(dot)co(dot)jp (Hiroshi Inoue)
Cc: wieck(at)debis(dot)com, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] FOREIGN KEY and shift/reduce
Date: 1999-12-07 04:33:14
Message-ID: m11vCJO-0003kJC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hiroshi Inoue wrote:

> Nice.
> I tried a little.
>
> < session 1 >
> => create table ri1 (id int4 primary key);
> NOTICE: CREATE TABLE/PRIMARY KEY will create implicit
> index 'ri1_pkey' for table 'ri1'
> CREATE
> => insert into ri1 values (1);
> INSERT 92940 1
> =>create table ri2 (id int4 references ri1 match full on delete restrict);
> NOTICE: CREATE TABLE will create implicit trigger(s) for
> FOREIGN KEY check(s)
> CREATE
> => begin;
> BEGIN
> => delete from ri1 where id=1;
> DELETE 1
>
> < session 2 >
> => insert into ri2 values (1);
> INSERT 92960 1

Outch,

I see the shared visibility conflict. So the CHECK constraint
trigger must get an exclusive lock somehow - I think an
internal "FOR UPDATE OF" can do it - will try.

Thanks, Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#========================================= wieck(at)debis(dot)com (Jan Wieck) #

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 1999-12-07 04:44:10 Re: [GENERAL] Oft Ask: How to contribute to PostgreSQL?
Previous Message Tom Lane 1999-12-07 04:29:54 Re: [HACKERS] Re: Book - SQL Aggregates