|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.120 2007/12/11 18:30:20 mha Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.121 2008/01/23 19:51:29 tgl Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="sql-syntax">
|
4 | 4 | <title>SQL Syntax</title>
|
@@ -1740,15 +1740,15 @@ SELECT somefunc() OR true;
|
1740 | 1740 | used. For example, this is an untrustworthy way of trying to
|
1741 | 1741 | avoid division by zero in a <literal>WHERE</> clause:
|
1742 | 1742 | <programlisting>
|
1743 |
| -SELECT ... WHERE x <> 0 AND y/x > 1.5; |
| 1743 | +SELECT ... WHERE x > 0 AND y/x > 1.5; |
1744 | 1744 | </programlisting>
|
1745 | 1745 | But this is safe:
|
1746 | 1746 | <programlisting>
|
1747 |
| -SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END; |
| 1747 | +SELECT ... WHERE CASE WHEN x > 0 THEN y/x > 1.5 ELSE false END; |
1748 | 1748 | </programlisting>
|
1749 | 1749 | A <literal>CASE</> construct used in this fashion will defeat optimization
|
1750 | 1750 | attempts, so it should only be done when necessary. (In this particular
|
1751 |
| - example, it would bebest to sidestep the problem by writing |
| 1751 | + example, it would bebetter to sidestep the problem by writing |
1752 | 1752 | <literal>y > 1.5*x</> instead.)
|
1753 | 1753 | </para>
|
1754 | 1754 | </sect2>
|
|