summaryrefslogtreecommitdiff
path: root/src/monoize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 15:32:31 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 15:32:31 -0400
commitdcd7b7d304959739432b3e2497491c36f14f2b4f (patch)
treebad7181fcc95e17aeb1dbb130a54c7c45d444976 /src/monoize.sml
parent959f07d717b29f083b275333b38e40e5b9f78a9d (diff)
Avoid unnecessary WHERE clause
Diffstat (limited to 'src/monoize.sml')
-rw-r--r--src/monoize.sml10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index 5341ab99..9846d8ba 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -613,8 +613,14 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
sc " FROM ",
strcatComma loc (map (fn (x, _) => strcat loc [(L'.EField (gf "From", x), loc),
sc (" AS " ^ x)]) tables),
- sc " WHERE ",
- gf "Where",
+ (L'.ECase (gf "Where",
+ [((L'.PPrim (Prim.String "TRUE"), loc),
+ sc ""),
+ ((L'.PWild, loc),
+ strcat loc [sc " WHERE ", gf "Where"])],
+ {disc = s,
+ result = s}), loc),
+
if List.all (fn (x, xts) =>
case List.find (fn (x', _) => x' = x) grouped of
NONE => List.null xts