Avoid mathematical inconsistency in example about avoiding division by
authorTom Lane
Wed, 23 Jan 2008 19:51:29 +0000 (19:51 +0000)
committerTom Lane
Wed, 23 Jan 2008 19:51:29 +0000 (19:51 +0000)
zero with a CASE expression.  Per gripe from Russell Smith.

doc/src/sgml/syntax.sgml

index c49d81b7f90935827ac9121dff21fb8979884200..8761b6e1da71c987b93d618426ed7cba37a4696a 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
 
  SQL Syntax
@@ -1740,15 +1740,15 @@ SELECT somefunc() OR true;
     used.  For example, this is an untrustworthy way of trying to
     avoid division by zero in a WHERE clause:
 
-SELECT ... WHERE x <> 0 AND y/x > 1.5;
+SELECT ... WHERE x > 0 AND y/x > 1.5;
 
     But this is safe:
 
-SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END;
+SELECT ... WHERE CASE WHEN x > 0 THEN y/x > 1.5 ELSE false END;
 
     A CASE construct used in this fashion will defeat optimization
     attempts, so it should only be done when necessary.  (In this particular
-    example, it would be best to sidestep the problem by writing
+    example, it would be better to sidestep the problem by writing
     y > 1.5*x instead.)