diff --git a/Database/Persist/GenericSql/Internal.hs b/Database/Persist/GenericSql/Internal.hs
--- a/Database/Persist/GenericSql/Internal.hs
+++ b/Database/Persist/GenericSql/Internal.hs
@@ -191,7 +191,15 @@
         case (isNull, pfilter, varCount) of
             (True, Eq, _) -> (name ++ " IS NULL", [])
             (True, Ne, _) -> (name ++ " IS NOT NULL", [])
-            (False, Ne, _) -> (name ++ " IS NULL", [])
+            (False, Ne, _) -> (concat
+                [ "("
+                , name
+                , " IS NULL OR "
+                , name
+                , " <> "
+                , qmarks
+                , ")"
+                ], notNullVals)
             -- We use 1=2 (and below 1=1) to avoid using TRUE and FALSE, since
             -- not all databases support those words directly.
             (_, In, 0) -> ("1=2", [])
diff --git a/persistent.cabal b/persistent.cabal
--- a/persistent.cabal
+++ b/persistent.cabal
@@ -1,5 +1,5 @@
 name:            persistent
-version:         0.6.4.1
+version:         0.6.4.2
 license:         BSD3
 license-file:    LICENSE
 author:          Michael Snoyman <michael@snoyman.com>
