summaryrefslogtreecommitdiff
path: root/src/pathcheck.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-07 16:14:31 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-07 16:14:31 -0400
commita4849d43a72070576fbb7a0d3a48956948152899 (patch)
tree6fa2aa05d829b2b71c6e2d778b4898999992a00f /src/pathcheck.sml
parente56ecefbc8cc0251d30511ec8c6cdc8dca25a263 (diff)
PRIMARY KEY
Diffstat (limited to 'src/pathcheck.sml')
-rw-r--r--src/pathcheck.sml18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/pathcheck.sml b/src/pathcheck.sml
index 6771e628..3f4f6be4 100644
--- a/src/pathcheck.sml
+++ b/src/pathcheck.sml
@@ -55,7 +55,7 @@ fun checkDecl ((d, loc), (funcs, rels)) =
case d of
DExport (_, s, _, _, _) => doFunc s
- | DTable (s, _, e) =>
+ | DTable (s, _, pe, ce) =>
let
fun constraints (e, rels) =
case #1 e of
@@ -71,8 +71,22 @@ fun checkDecl ((d, loc), (funcs, rels)) =
end
| EStrcat (e1, e2) => constraints (e2, constraints (e1, rels))
| _ => rels
+
+ val rels = #2 (doRel s)
+ val rels = case #1 pe of
+ EPrim (Prim.String "") => rels
+ | _ =>
+ let
+ val s' = s ^ "_Pkey"
+ in
+ if SS.member (rels, s') then
+ E.errorAt loc ("Duplicate primary key constraint path " ^ s')
+ else
+ ();
+ SS.add (rels, s')
+ end
in
- (funcs, constraints (e, #2 (doRel s)))
+ (funcs, constraints (ce, rels))
end
| DSequence s => doRel s