> -----Original Message-----
> From: owner-pgsql-hackers@postgreSQL.org
> [mailto:owner-pgsql-hackers@postgreSQL.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 implicitindex '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)forFOREIGN 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@tpf.co.jp