RE: [HACKERS] FOREIGN KEY and shift/reduce

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Jan Wieck" <wieck(at)debis(dot)com>
Cc: "PostgreSQL HACKERS" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: RE: [HACKERS] FOREIGN KEY and shift/reduce
Date: 1999-12-07 04:03:28
Message-ID: 001701bf4068$04aebc40$2801007e@cadzone.tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: owner-pgsql-hackers(at)postgreSQL(dot)org
> [mailto:owner-pgsql-hackers(at)postgreSQL(dot)org]On Behalf Of Jan Wieck
>
> Hi,
>
> I just committed a patch that turns on FOREIGN KEY. Thus,
> REFERENCES used in CREATE TABLE now automatically creates the
> appropriate constraint triggers. The implementation also
> supports omitting the PK column definition, if the
> corresponding columns should be the PRIMARY KEY of the
> referenced table.
>
> Also I completed some more of the generic trigger procs. For
> MATCH FULL, the key existence check in PK table and these
> actions are completed:
>
> ON DELETE RESTRICT
> ON DELETE CASCADE
> ON UPDATE RESTRICT
> ON UPDATE CASCADE
>

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

< session 1 >
=> commit;
END
=> select * from ri1;
id
--
(0 rows)
=> select * from ri2;
id
--
1
(1 row)

Is this a temporary behavior ?

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1999-12-07 04:07:17 Re: [HACKERS] TLE subselects (was: Raising funds for PostgreSQL)
Previous Message Jan Wieck 1999-12-07 03:55:50 Re: [HACKERS] When is 7.0 going Beta?