Avoid mathematical inconsistency in example about avoiding division by
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 23 Jan 2008 19:51:29 +0000 (19:51 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
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 7ec0e859b545549acf5531ee7ddffb077b35a47a..70fe502854bb9fa28c36bc2e4e4265229efb2146 100644 (file)
@@ -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 <literal>WHERE</> clause:
 <programlisting>
-SELECT ... WHERE x &lt;&gt; 0 AND y/x &gt; 1.5;
+SELECT ... WHERE x &gt; 0 AND y/x &gt; 1.5;
 </programlisting>
     But this is safe:
 <programlisting>
-SELECT ... WHERE CASE WHEN x &lt;&gt; 0 THEN y/x &gt; 1.5 ELSE false END;
+SELECT ... WHERE CASE WHEN x &gt; 0 THEN y/x &gt; 1.5 ELSE false END;
 </programlisting>
     A <literal>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
     <literal>y &gt; 1.5*x</> instead.)
    </para>
   </sect2>