summaryrefslogtreecommitdiff
path: root/tests/cst.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-07 18:47:47 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-07 18:47:47 -0400
commitf7c62ce8111cf0f31d65fb62b16e040fbfae0972 (patch)
treebecc08d27931380ecbc07af19ee9dc612d5edf47 /tests/cst.ur
parent0230ce71e14ea09b3037ff4b58c3bae323c12236 (diff)
FOREIGN KEY, without ability to link NULL to NOT NULL (and with some lingering problems in row inference)
Diffstat (limited to 'tests/cst.ur')
-rw-r--r--tests/cst.ur18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/cst.ur b/tests/cst.ur
index fc3b0816..548862be 100644
--- a/tests/cst.ur
+++ b/tests/cst.ur
@@ -1,3 +1,7 @@
+table u : {C : int, D : int, E : int}
+ PRIMARY KEY C,
+ CONSTRAINT U UNIQUE (C, D)
+
table t : {A : int, B : int}
PRIMARY KEY B,
@@ -11,7 +15,19 @@ table t : {A : int, B : int}
CONSTRAINT UniBothm UNIQUE ({#A}, {#B}),
CONSTRAINT UniBothm2 {unique [#A] [[B = _]] ! !},
- {{one_constraint [#UniBothm3] (unique [#A] [[B = _]] ! !)}}
+ {{one_constraint [#UniBothm3] (unique [#A] [[B = _]] ! !)}},
+
+ CONSTRAINT ForA FOREIGN KEY A REFERENCES u (C),
+ CONSTRAINT ForAB FOREIGN KEY (A, B) REFERENCES u (D, C) ON DELETE CASCADE ON UPDATE RESTRICT,
+ CONSTRAINT ForBA FOREIGN KEY (A, B) REFERENCES u (C, D) ON UPDATE NO ACTION,
+
+ CONSTRAINT Self FOREIGN KEY B REFERENCES t (B)
+
+table s : {B : option int}
+ CONSTRAINT UniB UNIQUE B
+
+table s2 : {B : option int}
+ CONSTRAINT ForB FOREIGN KEY B REFERENCES s (B) ON DELETE SET NULL
fun main () : transaction page =
queryI (SELECT * FROM t) (fn _ => return ());