From a4849d43a72070576fbb7a0d3a48956948152899 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 7 Apr 2009 16:14:31 -0400 Subject: PRIMARY KEY --- src/pathcheck.sml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/pathcheck.sml') 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 -- cgit v1.2.3