Author: paul
Date: 2006-07-07 18:09:20 +0200 (Fri, 07 Jul 2006)
New Revision: 2678
Log:
r11167@polar: paul | 2006-07-07 11:08:57 -0500
Discourage mixing of quoted and unquoted values in IN expressions.
Modified:
trunk/
trunk/refman-4.1/functions.xml
trunk/refman-5.0/functions.xml
trunk/refman-5.1/functions.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:11156
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:11967
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:8441
+ 4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:11167
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:11967
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:8441
Modified: trunk/refman-4.1/functions.xml
===================================================================
--- trunk/refman-4.1/functions.xml 2006-07-07 16:09:00 UTC (rev 2677)
+++ trunk/refman-4.1/functions.xml 2006-07-07 16:09:20 UTC (rev 2678)
@@ -1021,13 +1021,34 @@
<remark role="help-example"/>
<programlisting>
-mysql> <userinput>SELECT 2 IN (0,3,5,'wefwf');</userinput>
+mysql> <userinput>SELECT 2 IN (0,3,5,7);</userinput>
-> 0
-mysql> <userinput>SELECT 'wefwf' IN (0,3,5,'wefwf');</userinput>
+mysql> <userinput>SELECT 'wefwf' IN ('wee','wefwf','weg');</userinput>
-> 1
</programlisting>
<para>
+ You should never mix quoted and unquoted values in an
+ <literal>IN</literal> list because the comparison rules for
+ quoted values (such as strings) and unquoted values (such as
+ numbers) differ. Mixing types may therefore lead to
+ inconsistent results. For example, do not write an
+ <literal>IN</literal> expression like this:
+ </para>
+
+<programlisting>
+SELECT val1 FROM tbl1 WHERE val1 IN (1,2,'a');
+</programlisting>
+
+ <para>
+ Instead, write it like this:
+ </para>
+
+<programlisting>
+SELECT val1 FROM tbl1 WHERE val1 IN ('1','2','a');
+</programlisting>
+
+ <para>
The number of values in the <literal>IN</literal> list is
only limited by the <literal>max_allowed_packet</literal>
value.
@@ -4305,7 +4326,6 @@
<remark role="help-category" condition="Numeric Functions@Functions"/>
-
<para>
The usual arithmetic operators are available. The precision of
the result is determined according to the following rules:
@@ -4347,7 +4367,8 @@
argument + the value of the
<literal>div_precision_increment</literal> global variable.
For example, the expression <literal>5.05 / 0.0014</literal>
- would have a precision of six decimal places (<literal>4.047976</literal>).
+ would have a precision of six decimal places
+ (<literal>4.047976</literal>).
</para>
</listitem>
Modified: trunk/refman-5.0/functions.xml
===================================================================
--- trunk/refman-5.0/functions.xml 2006-07-07 16:09:00 UTC (rev 2677)
+++ trunk/refman-5.0/functions.xml 2006-07-07 16:09:20 UTC (rev 2678)
@@ -1091,13 +1091,34 @@
<remark role="help-example"/>
<programlisting>
-mysql> <userinput>SELECT 2 IN (0,3,5,'wefwf');</userinput>
+mysql> <userinput>SELECT 2 IN (0,3,5,7);</userinput>
-> 0
-mysql> <userinput>SELECT 'wefwf' IN (0,3,5,'wefwf');</userinput>
+mysql> <userinput>SELECT 'wefwf' IN ('wee','wefwf','weg');</userinput>
-> 1
</programlisting>
<para>
+ You should never mix quoted and unquoted values in an
+ <literal>IN</literal> list because the comparison rules for
+ quoted values (such as strings) and unquoted values (such as
+ numbers) differ. Mixing types may therefore lead to
+ inconsistent results. For example, do not write an
+ <literal>IN</literal> expression like this:
+ </para>
+
+<programlisting>
+SELECT val1 FROM tbl1 WHERE val1 IN (1,2,'a');
+</programlisting>
+
+ <para>
+ Instead, write it like this:
+ </para>
+
+<programlisting>
+SELECT val1 FROM tbl1 WHERE val1 IN ('1','2','a');
+</programlisting>
+
+ <para>
The number of values in the <literal>IN</literal> list is
only limited by the <literal>max_allowed_packet</literal>
value.
@@ -4393,7 +4414,6 @@
<remark role="help-category" condition="Numeric Functions@Functions"/>
-
<para>
The usual arithmetic operators are available. The precision of
the result is determined according to the following rules:
@@ -4435,7 +4455,8 @@
argument + the value of the
<literal>div_precision_increment</literal> global variable.
For example, the expression <literal>5.05 / 0.0014</literal>
- would have a precision of six decimal places (<literal>4.047976</literal>).
+ would have a precision of six decimal places
+ (<literal>4.047976</literal>).
</para>
</listitem>
Modified: trunk/refman-5.1/functions.xml
===================================================================
--- trunk/refman-5.1/functions.xml 2006-07-07 16:09:00 UTC (rev 2677)
+++ trunk/refman-5.1/functions.xml 2006-07-07 16:09:20 UTC (rev 2678)
@@ -1081,13 +1081,34 @@
<remark role="help-example"/>
<programlisting>
-mysql> <userinput>SELECT 2 IN (0,3,5,'wefwf');</userinput>
+mysql> <userinput>SELECT 2 IN (0,3,5,7);</userinput>
-> 0
-mysql> <userinput>SELECT 'wefwf' IN (0,3,5,'wefwf');</userinput>
+mysql> <userinput>SELECT 'wefwf' IN ('wee','wefwf','weg');</userinput>
-> 1
</programlisting>
<para>
+ You should never mix quoted and unquoted values in an
+ <literal>IN</literal> list because the comparison rules for
+ quoted values (such as strings) and unquoted values (such as
+ numbers) differ. Mixing types may therefore lead to
+ inconsistent results. For example, do not write an
+ <literal>IN</literal> expression like this:
+ </para>
+
+<programlisting>
+SELECT val1 FROM tbl1 WHERE val1 IN (1,2,'a');
+</programlisting>
+
+ <para>
+ Instead, write it like this:
+ </para>
+
+<programlisting>
+SELECT val1 FROM tbl1 WHERE val1 IN ('1','2','a');
+</programlisting>
+
+ <para>
The number of values in the <literal>IN</literal> list is
only limited by the <literal>max_allowed_packet</literal>
value.
@@ -4405,7 +4426,8 @@
argument + the value of the
<literal>div_precision_increment</literal> global variable.
For example, the expression <literal>5.05 / 0.0014</literal>
- would have a precision of six decimal places (<literal>4.047976</literal>).
+ would have a precision of six decimal places
+ (<literal>4.047976</literal>).
</para>
</listitem>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r2678 - in trunk: . refman-4.1 refman-5.0 refman-5.1 | paul | 7 Jul |