Author: paul
Date: 2005-12-05 18:11:11 +0100 (Mon, 05 Dec 2005)
New Revision: 487
Log:
r4487@frost: paul | 2005-12-05 10:06:03 -0600
Add note about space-padding for index comparisons for
non-binary strings. (Bug#10680)
Modified:
trunk/
trunk/refman-4.1/column-types.xml
trunk/refman-5.0/column-types.xml
trunk/refman-5.1/column-types.xml
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:4486
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:1464
+ b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:4487
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:1464
Modified: trunk/refman-4.1/column-types.xml
===================================================================
--- trunk/refman-4.1/column-types.xml 2005-12-05 17:10:30 UTC (rev 486)
+++ trunk/refman-4.1/column-types.xml 2005-12-05 17:11:11 UTC (rev 487)
@@ -3811,6 +3811,16 @@
</para>
<para>
+ If a <literal>CHAR</literal> or <literal>VARCHAR</literal>
+ column is indexed, index entry comparisons are space-padded at
+ the end. This means that, if the index requires unique values,
+ duplicate-key errors will occur for values that differ only in
+ the number of trailing spaces. For example, inserting
+ <literal>'a'</literal> and <literal>'a '</literal> causes a
+ duplicate-key error.
+ </para>
+
+ <para>
If you assign a value to a <literal>CHAR</literal> or
<literal>VARCHAR</literal> column that exceeds the column's
maximum length, the value is truncated to fit. If the truncated
@@ -4147,7 +4157,18 @@
</para>
<para>
- No lettercase conversion takes place during storage or
+ If a <literal>TEXT</literal> column is indexed, index entry
+ comparisons are space-padded at the end. This means that, if the
+ index requires unique values, duplicate-key errors will occur
+ for values that differ only in the number of trailing spaces.
+ For example, inserting <literal>'a'</literal> and <literal>'a
+ '</literal> causes a duplicate-key error. This is not true for
+ <literal>BLOB</literal> columns.
+ </para>
+
+ <para>
+ No lettercase conversion for <literal>TEXT</literal> or
+ <literal>BLOB</literal> columns takes place during storage or
retrieval.
</para>
@@ -5131,11 +5152,11 @@
To calculate the number of <emphasis>bytes</emphasis> used to
store a particular <literal>CHAR</literal>,
<literal>VARCHAR</literal>, or <literal>TEXT</literal> column
- value in MySQL 4.1 (and later), you will need to take into account
- the character set in use for that column. In particular, when using
- Unicode, you must keep in mind that not all Unicode characters use
- the same number of bytes. For a breakdown of the storage used for
- different categories of Unicode characters, see
+ value in MySQL 4.1 (and later), you will need to take into account
+ the character set in use for that column. In particular, when
+ using Unicode, you must keep in mind that not all Unicode
+ characters use the same number of bytes. For a breakdown of the
+ storage used for different categories of Unicode characters, see
<xref linkend="charset-unicode"/>.
</para>
Modified: trunk/refman-5.0/column-types.xml
===================================================================
--- trunk/refman-5.0/column-types.xml 2005-12-05 17:10:30 UTC (rev 486)
+++ trunk/refman-5.0/column-types.xml 2005-12-05 17:11:11 UTC (rev 487)
@@ -3550,6 +3550,16 @@
</para>
<para>
+ If a <literal>CHAR</literal> or <literal>VARCHAR</literal>
+ column is indexed, index entry comparisons are space-padded at
+ the end. This means that, if the index requires unique values,
+ duplicate-key errors will occur for values that differ only in
+ the number of trailing spaces. For example, inserting
+ <literal>'a'</literal> and <literal>'a '</literal> causes a
+ duplicate-key error.
+ </para>
+
+ <para>
If you assign a value to a <literal>CHAR</literal> or
<literal>VARCHAR</literal> column that exceeds the column's
maximum length, the value is truncated to fit. If the truncated
@@ -3978,6 +3988,16 @@
</para>
<para>
+ If a <literal>TEXT</literal> column is indexed, index entry
+ comparisons are space-padded at the end. This means that, if the
+ index requires unique values, duplicate-key errors will occur
+ for values that differ only in the number of trailing spaces.
+ For example, inserting <literal>'a'</literal> and <literal>'a
+ '</literal> causes a duplicate-key error. This is not true for
+ <literal>BLOB</literal> columns.
+ </para>
+
+ <para>
No lettercase conversion for <literal>TEXT</literal> or
<literal>BLOB</literal> columns takes place during storage or
retrieval.
@@ -4886,22 +4906,21 @@
</row>
<row>
<entry><literal>VARCHAR(<replaceable>M</replaceable>)</literal></entry>
- <entry><emphasis>Prior to MySQL 5.0.3</emphasis>:
- <replaceable>L</replaceable> + 1 bytes, where
- <literal><replaceable>L</replaceable> <=
- <replaceable>M</replaceable></literal> and 0
+ <entry><emphasis>Prior to MySQL 5.0.3</emphasis>: <replaceable>L</replaceable>
+ + 1 bytes, where <literal><replaceable>L</replaceable>
+ <= <replaceable>M</replaceable></literal> and 0
<literal><= <replaceable>M</replaceable>
- <=</literal> 255. <emphasis>MySQL 5.0.3 and later</emphasis>:
- <replaceable>L</replaceable> + 1 bytes, where
- <literal><replaceable>L</replaceable> <=
+ <=</literal> 255. <emphasis>MySQL 5.0.3 and
+ later</emphasis>: <replaceable>L</replaceable> + 1 bytes,
+ where <literal><replaceable>L</replaceable> <=
<replaceable>M</replaceable></literal> and 0
<literal><= <replaceable>M</replaceable>
- <=</literal> 256 <emphasis>or</emphasis>
- <replaceable>L</replaceable> + 2 bytes, where
+ <=</literal> 256 <emphasis>or</emphasis>
+ <replaceable>L</replaceable> + 2 bytes, where
<literal><replaceable>L</replaceable> <=
<replaceable>M</replaceable></literal> and 256
- <literal>< <replaceable>M</replaceable>
- <=</literal> 65535 (see note below).</entry>
+ <literal>< <replaceable>M</replaceable> <=</literal>
+ 65535 (see note below).</entry>
</row>
<row>
<entry><literal>BINARY(<replaceable>M</replaceable>)</literal></entry>
@@ -5020,38 +5039,40 @@
<literal>VARCHAR</literal> column from a table in a MySQL Cluster
will behave as follows:
</para>
-
+
<itemizedlist>
+
<listitem>
<para>
If the size of the column is 256 characters or fewer, then the
column requires one extra byte of storage per row.
</para>
</listitem>
-
+
<listitem>
<para>
If the size of the column is geater than 256 characters, then
the column requires 2 bytes extra storage per row.
</para>
</listitem>
+
</itemizedlist>
-
+
<para>
Note that the number of bytes required per character varies
according to the character set used. For example, if a
<literal>VARCHAR(100)</literal> column in a Cluster table uses the
- <literal>utf-8</literal> character set, then each character requires 3
- bytes storage. This means that each record in such a column takes up
- 100 × 3 + 1 = 301 bytes for storage, regardless of the
- length of the string actually stored in any given record. For a
- <literal>VARCHAR(1000)</literal> column in a table using the
- <literal>NDBCLUSTER</literal> storage engine with the
- <literal>utf-8</literal> character set, each record will use 1000
- × 3 + 2 = 3002 bytes storage; that is, the
- column is 1,000 characters wide, each character requires 3 bytes
- storage, and each record has a 2-byte overhead because 1,000 >
- 256.
+ <literal>utf-8</literal> character set, then each character
+ requires 3 bytes storage. This means that each record in such a
+ column takes up 100 × 3 + 1 = 301 bytes for
+ storage, regardless of the length of the string actually stored in
+ any given record. For a <literal>VARCHAR(1000)</literal> column in
+ a table using the <literal>NDBCLUSTER</literal> storage engine
+ with the <literal>utf-8</literal> character set, each record will
+ use 1000 × 3 + 2 = 3002 bytes storage; that is,
+ the column is 1,000 characters wide, each character requires 3
+ bytes storage, and each record has a 2-byte overhead because 1,000
+ > 256.
</para>
<para>
Modified: trunk/refman-5.1/column-types.xml
===================================================================
--- trunk/refman-5.1/column-types.xml 2005-12-05 17:10:30 UTC (rev 486)
+++ trunk/refman-5.1/column-types.xml 2005-12-05 17:11:11 UTC (rev 487)
@@ -3441,6 +3441,16 @@
</para>
<para>
+ If a <literal>CHAR</literal> or <literal>VARCHAR</literal>
+ column is indexed, index entry comparisons are space-padded at
+ the end. This means that, if the index requires unique values,
+ duplicate-key errors will occur for values that differ only in
+ the number of trailing spaces. For example, inserting
+ <literal>'a'</literal> and <literal>'a '</literal> causes a
+ duplicate-key error.
+ </para>
+
+ <para>
If you assign a value to a <literal>CHAR</literal> or
<literal>VARCHAR</literal> column that exceeds the column's
maximum length, the value is truncated to fit. If the truncated
@@ -3818,6 +3828,16 @@
</para>
<para>
+ If a <literal>TEXT</literal> column is indexed, index entry
+ comparisons are space-padded at the end. This means that, if the
+ index requires unique values, duplicate-key errors will occur
+ for values that differ only in the number of trailing spaces.
+ For example, inserting <literal>'a'</literal> and <literal>'a
+ '</literal> causes a duplicate-key error. This is not true for
+ <literal>BLOB</literal> columns.
+ </para>
+
+ <para>
No lettercase conversion for <literal>TEXT</literal> or
<literal>BLOB</literal> columns takes place during storage or
retrieval.
@@ -4717,12 +4737,12 @@
<literal><replaceable>L</replaceable> <=
<replaceable>M</replaceable></literal> and 0
<literal><= <replaceable>M</replaceable>
- <=</literal> 256 (see note below)
+ <=</literal> 256 (see note below)
<emphasis>or</emphasis> <replaceable>L</replaceable> + 2
- bytes, where <literal><replaceable>L</replaceable> <=
+ bytes, where <literal><replaceable>L</replaceable> <=
<replaceable>M</replaceable></literal> and 256
- <literal>< <replaceable>M</replaceable>
- <=</literal> 65535 (see note below).</entry>
+ <literal>< <replaceable>M</replaceable> <=</literal>
+ 65535 (see note below).</entry>
</row>
<row>
<entry><literal>BINARY(<replaceable>M</replaceable>)</literal></entry>
@@ -4791,27 +4811,29 @@
<literal>TEXT</literal> types are variable-length types. For each,
the storage requirements depend on these factors:
</para>
-
+
<itemizedlist>
+
<listitem>
<para>
The actual actual length of the column value
</para>
</listitem>
-
+
<listitem>
<para>
The column's maximum possible size
</para>
</listitem>
-
+
<listitem>
<para>
The character set used for the column
</para>
</listitem>
- </itemizedlist>
-
+
+ </itemizedlist>
+
<para>
For example, a <literal>VARCHAR(10)</literal> column can hold a
string with a maximum length of 10. Assuming that the column uses
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r487 - in trunk: . refman-4.1 refman-5.0 refman-5.1 | paul | 5 Dec |