Author: jstephens
Date: 2006-04-20 15:26:06 +0200 (Thu, 20 Apr 2006)
New Revision: 1889
Log:
Added new text from rev 1884 to Replication chapter. (Suggested by Paul)
Modified:
trunk/refman-4.1/replication.xml
trunk/refman-5.0/replication.xml
trunk/refman-5.1/replication.xml
Modified: trunk/refman-4.1/replication.xml
===================================================================
--- trunk/refman-4.1/replication.xml 2006-04-20 12:49:38 UTC (rev 1888)
+++ trunk/refman-4.1/replication.xml 2006-04-20 13:26:06 UTC (rev 1889)
@@ -1695,6 +1695,41 @@
This assumes that the table <literal>t1</literal> has columns
<literal>col1</literal> and <literal>col2</literal>.
</para>
+
+
+ <para>
+ This set of statements will also produce a new table
+ <literal>t2</literal> identical to <literal>t1</literal>, with
+ the addition of an <literal>AUTO_INCREMENT</literal> column:
+ </para>
+
+<programlisting>
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE T2 ADD id INT AUTO_INCREMENT PRIMARY KEY;
+INSERT INTO t2 SELECT * FROM t1 ORDER BY col1, col2;
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Important</emphasis>: To guarantee the
+ same ordering on both master and slave, <emphasis>all</emphasis>
+ columns of <literal>t1</literal> must be referenced in the
+ <literal>ORDER BY</literal> clause.
+ </para>
+
+ <para>
+ Regardless of the method used to create and populate the copy
+ having the <literal>AUTO_INCREMENT</literal> column, the final
+ step is to drop the original table and then rename the copy:
+ </para>
+
+<programlisting>
+DROP t1;
+ALTER TABLE t2 RENAME t1;
+</programlisting>
+
+ <para>
+ See also <xref linkend="alter-table-problems"/>.
+ </para>
</listitem>
<listitem>
Modified: trunk/refman-5.0/replication.xml
===================================================================
--- trunk/refman-5.0/replication.xml 2006-04-20 12:49:38 UTC (rev 1888)
+++ trunk/refman-5.0/replication.xml 2006-04-20 13:26:06 UTC (rev 1889)
@@ -1649,6 +1649,41 @@
This assumes that the table <literal>t1</literal> has columns
<literal>col1</literal> and <literal>col2</literal>.
</para>
+
+
+ <para>
+ This set of statements will also produce a new table
+ <literal>t2</literal> identical to <literal>t1</literal>, with
+ the addition of an <literal>AUTO_INCREMENT</literal> column:
+ </para>
+
+<programlisting>
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE T2 ADD id INT AUTO_INCREMENT PRIMARY KEY;
+INSERT INTO t2 SELECT * FROM t1 ORDER BY col1, col2;
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Important</emphasis>: To guarantee the
+ same ordering on both master and slave, <emphasis>all</emphasis>
+ columns of <literal>t1</literal> must be referenced in the
+ <literal>ORDER BY</literal> clause.
+ </para>
+
+ <para>
+ Regardless of the method used to create and populate the copy
+ having the <literal>AUTO_INCREMENT</literal> column, the final
+ step is to drop the original table and then rename the copy:
+ </para>
+
+<programlisting>
+DROP t1;
+ALTER TABLE t2 RENAME t1;
+</programlisting>
+
+ <para>
+ See also <xref linkend="alter-table-problems"/>.
+ </para>
</listitem>
<listitem>
Modified: trunk/refman-5.1/replication.xml
===================================================================
--- trunk/refman-5.1/replication.xml 2006-04-20 12:49:38 UTC (rev 1888)
+++ trunk/refman-5.1/replication.xml 2006-04-20 13:26:06 UTC (rev 1889)
@@ -1856,6 +1856,40 @@
This assumes that the table <literal>t1</literal> has columns
<literal>col1</literal> and <literal>col2</literal>.
</para>
+
+ <para>
+ This set of statements will also produce a new table
+ <literal>t2</literal> identical to <literal>t1</literal>, with
+ the addition of an <literal>AUTO_INCREMENT</literal> column:
+ </para>
+
+<programlisting>
+CREATE TABLE t2 LIKE t1;
+ALTER TABLE T2 ADD id INT AUTO_INCREMENT PRIMARY KEY;
+INSERT INTO t2 SELECT * FROM t1 ORDER BY col1, col2;
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Important</emphasis>: To guarantee the
+ same ordering on both master and slave, <emphasis>all</emphasis>
+ columns of <literal>t1</literal> must be referenced in the
+ <literal>ORDER BY</literal> clause.
+ </para>
+
+ <para>
+ Regardless of the method used to create and populate the copy
+ having the <literal>AUTO_INCREMENT</literal> column, the final
+ step is to drop the original table and then rename the copy:
+ </para>
+
+<programlisting>
+DROP t1;
+ALTER TABLE t2 RENAME t1;
+</programlisting>
+
+ <para>
+ See also <xref linkend="alter-table-problems"/>.
+ </para>
</listitem>
<listitem>
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r1889 - in trunk: refman-4.1 refman-5.0 refman-5.1 | jon | 20 Apr |