[Pkg-mysql-commits] r1138 - in trunk/debian: . patches

Norbert Tretkowski nobse at alioth.debian.org
Sat Feb 2 10:39:47 UTC 2008


Author: nobse
Date: 2008-02-02 10:39:47 +0000 (Sat, 02 Feb 2008)
New Revision: 1138

Added:
   trunk/debian/patches/51_incorrect-order.dpatch
Modified:
   trunk/debian/changelog
   trunk/debian/patches/00list
Log:
New patch from 5.0.52 to fix incorrect order when using range conditions on 2 tables or more.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-01-30 21:17:44 UTC (rev 1137)
+++ trunk/debian/changelog	2008-02-02 10:39:47 UTC (rev 1138)
@@ -8,7 +8,9 @@
     + debian/patches/93_SECURITY_CVE-2007-6304.dpatch
     + debian/patches/94_SECURITY_CVE-2008-0226+0227.dpatch
   * New patch 60_raise-max-keylength.dpatch to raise the maximum key length to
-    4005 bytes or 1335 UTF-8 characters. (closes: 463137)
+    4005 bytes or 1335 UTF-8 characters. (closes: #463137)
+  * New patch 51_sort-order.dpatch from 5.0.52 to fix incorrect order when
+    using range conditions on 2 tables or more.
   * Add recommendation on libhtml-template-perl to -server package, used by
     ndb_size. (closes: #462265)
   * Update mysqlreport to 3.4a release.
@@ -16,7 +18,7 @@
   [ Luk Claes ]
   * Updated Japanese debconf translation (Closes: #462158).
 
- -- Norbert Tretkowski <nobse at debian.org>  Tue, 29 Jan 2008 18:48:06 +0100
+ -- Norbert Tretkowski <nobse at debian.org>  Sat, 02 Feb 2008 11:32:34 +0100
 
 mysql-dfsg-5.0 (5.0.51-3) unstable; urgency=high
 

Modified: trunk/debian/patches/00list
===================================================================
--- trunk/debian/patches/00list	2008-01-30 21:17:44 UTC (rev 1137)
+++ trunk/debian/patches/00list	2008-02-02 10:39:47 UTC (rev 1138)
@@ -7,6 +7,7 @@
 44_scripts__mysql_config__libs.dpatch
 45_warn-CLI-passwords.dpatch
 50_fix_mysqldump.dpatch
+51_incorrect-order.dpatch
 52_ndb-gcc-4.2.dpatch
 53_integer-gcc-4.2.dpatch
 54_ssl-client-support.dpatch

Added: trunk/debian/patches/51_incorrect-order.dpatch
===================================================================
--- trunk/debian/patches/51_incorrect-order.dpatch	                        (rev 0)
+++ trunk/debian/patches/51_incorrect-order.dpatch	2008-02-02 10:39:47 UTC (rev 1138)
@@ -0,0 +1,115 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 51_incorrect-order.dpatch by Norbert Tretkowski <nobse at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: http://lists.mysql.com/commits/37246
+
+ at DPATCH@
+diff -Nrup a/mysql-test/r/select.result b/mysql-test/r/select.result
+--- a/mysql-test/r/select.result	2007-09-13 17:31:07 +04:00
++++ b/mysql-test/r/select.result	2007-11-07 14:00:41 +03:00
+@@ -4096,4 +4096,43 @@ SELECT `x` FROM v3;
+ x
+ 1
+ DROP VIEW v1, v2, v3;
++CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);
++CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, 
++c22 INT DEFAULT NULL, 
++KEY(c21, c22));
++CREATE TABLE t3 (c31 INT UNSIGNED NOT NULL DEFAULT 0, 
++c32 INT DEFAULT NULL, 
++c33 INT NOT NULL, 
++c34 INT UNSIGNED DEFAULT 0,
++KEY (c33, c34, c32));
++INSERT INTO t1 values (),(),(),(),();
++INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a, t1 b;
++INSERT INTO t3 VALUES (1, 1, 1, 0), 
++(2, 2, 0, 0), 
++(3, 3, 1, 0), 
++(4, 4, 0, 0), 
++(5, 5, 1, 0);
++SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND 
++t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND 
++t3.c33 = 1 AND t2.c22 in (1, 3) 
++ORDER BY c32;
++c32
++1
++1
++3
++3
++5
++5
++SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND 
++t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND 
++t3.c33 = 1 AND t2.c22 in (1, 3) 
++ORDER BY c32 DESC;
++c32
++5
++5
++3
++3
++1
++1
++DROP TABLE t1, t2, t3;
+ End of 5.0 tests
+diff -Nrup a/mysql-test/t/select.test b/mysql-test/t/select.test
+--- a/mysql-test/t/select.test	2007-09-15 09:02:02 +04:00
++++ b/mysql-test/t/select.test	2007-11-07 14:00:41 +03:00
+@@ -3484,4 +3484,40 @@ DROP VIEW v1, v2, v3;
+ 
+ --enable_ps_protocol
+ 
++#
++# Bug #30666: Incorrect order when using range conditions on 2 tables or more
++#
++
++CREATE TABLE t1 (c11 INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY);
++CREATE TABLE t2 (c21 INT UNSIGNED NOT NULL, 
++                 c22 INT DEFAULT NULL, 
++                 KEY(c21, c22));
++CREATE TABLE t3 (c31 INT UNSIGNED NOT NULL DEFAULT 0, 
++                 c32 INT DEFAULT NULL, 
++                 c33 INT NOT NULL, 
++                 c34 INT UNSIGNED DEFAULT 0,
++                 KEY (c33, c34, c32));
++
++INSERT INTO t1 values (),(),(),(),();
++INSERT INTO t2 SELECT a.c11, b.c11 FROM t1 a, t1 b;
++INSERT INTO t3 VALUES (1, 1, 1, 0), 
++                      (2, 2, 0, 0), 
++                      (3, 3, 1, 0), 
++                      (4, 4, 0, 0), 
++                      (5, 5, 1, 0);
++
++# Show that ORDER BY produces the correct results order
++SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND 
++                                 t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND 
++                                 t3.c33 = 1 AND t2.c22 in (1, 3) 
++                           ORDER BY c32; 
++
++# Show that ORDER BY DESC produces the correct results order
++SELECT c32 FROM t1, t2, t3 WHERE t1.c11 IN (1, 3, 5) AND 
++                                 t3.c31 = t1.c11 AND t2.c21 = t1.c11 AND 
++                                 t3.c33 = 1 AND t2.c22 in (1, 3) 
++                           ORDER BY c32 DESC; 
++
++DROP TABLE t1, t2, t3;
++
+ --echo End of 5.0 tests
+diff -Nrup a/sql/sql_select.cc b/sql/sql_select.cc
+--- a/sql/sql_select.cc	2007-10-02 18:45:48 +04:00
++++ b/sql/sql_select.cc	2007-11-07 14:00:42 +03:00
+@@ -6071,10 +6071,9 @@ make_join_readinfo(JOIN *join, ulonglong
+       ordered. If there is a temp table the ordering is done as a last
+       operation and doesn't prevent join cache usage.
+     */
+-    if (!ordered_set && !join->need_tmp &&
+-        ((table == join->sort_by_table &&
+-         (!join->order || join->skip_sort_order)) ||
+-        (join->sort_by_table == (TABLE *) 1 && i != join->const_tables)))
++    if (!ordered_set && !join->need_tmp && 
++        (table == join->sort_by_table ||
++         (join->sort_by_table == (TABLE *) 1 && i != join->const_tables)))
+       ordered_set= 1;
+ 
+     switch (tab->type) {




More information about the Pkg-mysql-commits mailing list