MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:October 23 2007 2:03pm
Subject:bk commit into 5.0 tree (anozdrin:1.2543) BUG#30736
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of alik. When alik does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-10-23 18:03:51+04:00, anozdrin@station. +3 -0
  Patch for BUG#30736: Row Size Too Large Error Creating a Table and
  Inserting Data.
  
  The problem was that under some circumstances Field class was not
  properly initialized before calling create_length_to_internal_length()
  function, which led to assert failure.
  
  The fix is to do the proper initialization.
  
  The user-visible problem was that under some circumstances
  CREATE TABLE ... SELECT statement crashed the server or led
  to wrong error message (wrong results).

  mysql-test/r/select.result@stripped, 2007-10-23 18:03:49+04:00, anozdrin@station. +35 -0
    Update result file.

  mysql-test/t/select.test@stripped, 2007-10-23 18:03:49+04:00, anozdrin@station. +48 -0
    Add a test case for BUG#30736: Row Size Too Large Error
    Creating a Table and Inserting Data.

  sql/sql_table.cc@stripped, 2007-10-23 18:03:49+04:00, anozdrin@station. +1 -1
    Move sql_field->decimals initialization before
    sql_field->create_length_to_internal_length() call.

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-10-23 18:03:49 +04:00
@@ -4096,4 +4096,39 @@ SELECT `x` FROM v3;
 x
 1
 DROP VIEW v1, v2, v3;
+
+#
+# Bug#30736: Row Size Too Large Error Creating a Table and
+# Inserting Data.
+#
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+
+CREATE TABLE t1(
+c1 DECIMAL(10, 2),
+c2 FLOAT);
+
+INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5);
+
+CREATE TABLE t2(
+c3 DECIMAL(10, 2))
+SELECT
+c1 * c2 AS c3
+FROM t1;
+
+SELECT * FROM t1;
+c1	c2
+0.00	1
+2.00	3
+4.00	5
+
+SELECT * FROM t2;
+c3
+0.00
+6.00
+20.00
+
+DROP TABLE t1;
+DROP TABLE t2;
+
 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-10-23 18:03:49 +04:00
@@ -3484,4 +3484,52 @@ DROP VIEW v1, v2, v3;
 
 --enable_ps_protocol
 
+###########################################################################
+
+--echo
+--echo #
+--echo # Bug#30736: Row Size Too Large Error Creating a Table and
+--echo # Inserting Data.
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+--echo
+
+CREATE TABLE t1(
+  c1 DECIMAL(10, 2),
+  c2 FLOAT);
+
+--echo
+
+INSERT INTO t1 VALUES (0, 1), (2, 3), (4, 5);
+
+--echo
+
+CREATE TABLE t2(
+  c3 DECIMAL(10, 2))
+  SELECT
+    c1 * c2 AS c3
+  FROM t1;
+
+--echo
+
+SELECT * FROM t1;
+
+--echo
+
+SELECT * FROM t2;
+
+--echo
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+--echo
+
+###########################################################################
+
 --echo End of 5.0 tests
diff -Nrup a/sql/sql_table.cc b/sql/sql_table.cc
--- a/sql/sql_table.cc	2007-08-05 07:53:13 +04:00
+++ b/sql/sql_table.cc	2007-10-23 18:03:49 +04:00
@@ -955,8 +955,8 @@ static int mysql_prepare_table(THD *thd,
 	  sql_field->length=		dup_field->char_length;
           sql_field->pack_length=	dup_field->pack_length;
           sql_field->key_length=	dup_field->key_length;
-	  sql_field->create_length_to_internal_length();
 	  sql_field->decimals=		dup_field->decimals;
+	  sql_field->create_length_to_internal_length();
 	  sql_field->unireg_check=	dup_field->unireg_check;
           /* 
             We're making one field from two, the result field will have
Thread
bk commit into 5.0 tree (anozdrin:1.2543) BUG#30736Alexander Nozdrin23 Oct