diff src/monoize.sml @ 258:40c33706d887

Avoid unnecessary WHERE clause
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 15:32:31 -0400
parents 69d337f186eb
children d1b679dbbc25
line wrap: on
line diff
--- a/src/monoize.sml	Sun Aug 31 15:18:00 2008 -0400
+++ b/src/monoize.sml	Sun Aug 31 15:32:31 2008 -0400
@@ -613,8 +613,14 @@
                                            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