Re: RI and PARSER (was: Re: [HACKERS] RI status report #1)

Jan Wieck <wieck@debis.com>

From: wieck@debis.com (Jan Wieck)
To: djackson@cpsgroup.com (Jackson, DeJuan)
Cc: wieck@debis.com, lockhart@alumni.caltech.edu, tgl@sss.pgh.pa.us, hackers@postgreSQL.org
Date: 1999-09-29T17:25:32Z
Lists: pgsql-hackers
>
> What does PENDANT imply/mean in terms of RI?  I could figure out all of the
> other syntax.

    As far as I understood it:

      CREATE TABLE t1 (a1 integer PRIMARY KEY NOT NULL, b1 text);

      CREATE TABLE t2 (a2 integer NOT NULL, b2 text,
                       CONSTRAINT check_a2
                         FOREIGN KEY (a2)
                         REFERENCES t1 (a1)
                         PENDANT
                         ON DELETE CASCADE
                         ON UPDATE CASCADE
                         INITIALLY DEFERRED);

    This  setup requires, that for each key in t1.a1 at least one
    reference  from  t2.a2  MUST  exist.  So  this  is  a  cyclic
    integrity check.  I'm not sure if removing the last reference
    automatically removes the PK row from t1 or if it  raises  an
    error. Can someone clearify here?


Jan

--

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