Mercurial > urweb
comparison tests/cst.ur @ 709:0406e9cccb72
FOREIGN KEY, without ability to link NULL to NOT NULL (and with some lingering problems in row inference)
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 07 Apr 2009 18:47:47 -0400 |
parents | d8217b4cb617 |
children | 915ec60592d4 |
comparison
equal
deleted
inserted
replaced
708:1a317a707d71 | 709:0406e9cccb72 |
---|---|
1 table u : {C : int, D : int, E : int} | |
2 PRIMARY KEY C, | |
3 CONSTRAINT U UNIQUE (C, D) | |
4 | |
1 table t : {A : int, B : int} | 5 table t : {A : int, B : int} |
2 PRIMARY KEY B, | 6 PRIMARY KEY B, |
3 | 7 |
4 CONSTRAINT UniA UNIQUE A, | 8 CONSTRAINT UniA UNIQUE A, |
5 CONSTRAINT UniB UNIQUE B, | 9 CONSTRAINT UniB UNIQUE B, |
9 CONSTRAINT UniAm2 {unique [#A] [[]] ! !}, | 13 CONSTRAINT UniAm2 {unique [#A] [[]] ! !}, |
10 {{one_constraint [#UniAm3] (unique [#A] [[]] ! !)}}, | 14 {{one_constraint [#UniAm3] (unique [#A] [[]] ! !)}}, |
11 | 15 |
12 CONSTRAINT UniBothm UNIQUE ({#A}, {#B}), | 16 CONSTRAINT UniBothm UNIQUE ({#A}, {#B}), |
13 CONSTRAINT UniBothm2 {unique [#A] [[B = _]] ! !}, | 17 CONSTRAINT UniBothm2 {unique [#A] [[B = _]] ! !}, |
14 {{one_constraint [#UniBothm3] (unique [#A] [[B = _]] ! !)}} | 18 {{one_constraint [#UniBothm3] (unique [#A] [[B = _]] ! !)}}, |
19 | |
20 CONSTRAINT ForA FOREIGN KEY A REFERENCES u (C), | |
21 CONSTRAINT ForAB FOREIGN KEY (A, B) REFERENCES u (D, C) ON DELETE CASCADE ON UPDATE RESTRICT, | |
22 CONSTRAINT ForBA FOREIGN KEY (A, B) REFERENCES u (C, D) ON UPDATE NO ACTION, | |
23 | |
24 CONSTRAINT Self FOREIGN KEY B REFERENCES t (B) | |
25 | |
26 table s : {B : option int} | |
27 CONSTRAINT UniB UNIQUE B | |
28 | |
29 table s2 : {B : option int} | |
30 CONSTRAINT ForB FOREIGN KEY B REFERENCES s (B) ON DELETE SET NULL | |
15 | 31 |
16 fun main () : transaction page = | 32 fun main () : transaction page = |
17 queryI (SELECT * FROM t) (fn _ => return ()); | 33 queryI (SELECT * FROM t) (fn _ => return ()); |
18 return <xml/> | 34 return <xml/> |