3420 Norvald H. Ryeng 2011-08-30 [merge]
Merge 5.5 => trunk
modified:
mysql-test/r/group_by.result
mysql-test/t/group_by.test
sql/filesort.cc
3419 Dmitry Shulga 2011-08-30
Fixed bug#11748057 - ALTER TABLE statement doesn't identify correct
column name.
The problem was that execution of an ALTER TABLE statement that tried in the
same statement to ADD a column into a table AFTER some specified column (e.g.
c2) and MODIFY this column by moving it resulted in unwarranted failure
with a message like ERROR 1054 (42S22): Unknown column 'c2' in 't1'.
For example, if a user tries to execute the following statement:
ALTER TABLE t1 ADD c3 INT AFTER c2,
MODIFY c2 INT AFTER c1;
then statement execution will fail with error message:
ERROR 1054 (42S22): Unknown column 'c2' in 't1'.
What happened was that during preparing of description for new
version of the table being altered in mysql_prepare_alter_table() we
improperly handled existing columns which changed their position.
Such columns were initially omitted from the list of columns for
new version of table and thus when ADD COLUMN ... AFTER ... clauses
were processed they were not found in some cases. As a result user
got "Unknown column" error.
This fix solves the problem by ensuring that modified columns which
change their position are not omitted but added to the list of
columns for the new version of table prior to processing of ADD COLUMN
clauses.
@ mysql-test/r/alter_table.result
Added testcase result for bug#11748057.
@ mysql-test/t/alter_table.test
Added testcase for bug#11748057.
modified:
mysql-test/r/alter_table.result
mysql-test/t/alter_table.test
sql/sql_table.cc
=== modified file 'mysql-test/r/group_by.result'
--- a/mysql-test/r/group_by.result 2011-08-17 11:50:34 +0000
+++ b/mysql-test/r/group_by.result 2011-08-30 09:01:05 +0000
@@ -1892,6 +1892,38 @@ a AVG(t1.b) t11c t12c
1 4.0000 6 6
2 2.0000 7 7
DROP TABLE t1;
+#
+# Bug#11765254 (58200): Assertion failed: param.sort_length when grouping
+# by functions
+#
+SET BIG_TABLES=1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0),(0);
+SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
+1
+1
+SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
+1
+1
+SELECT 1 FROM t1 GROUP BY SUBSTRING('',SLEEP(0),'');
+1
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: ''
+Warning 1292 Truncated incorrect INTEGER value: ''
+Warning 1292 Truncated incorrect INTEGER value: ''
+SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<');
+1
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'K'
+Warning 1292 Truncated incorrect INTEGER value: 'jxW<'
+Warning 1292 Truncated incorrect INTEGER value: 'K'
+Warning 1292 Truncated incorrect INTEGER value: 'jxW<'
+Warning 1292 Truncated incorrect INTEGER value: 'K'
+Warning 1292 Truncated incorrect INTEGER value: 'jxW<'
+DROP TABLE t1;
+SET BIG_TABLES=0;
# End of 5.1 tests
#
# Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00
=== modified file 'mysql-test/t/group_by.test'
--- a/mysql-test/t/group_by.test 2011-08-15 09:13:05 +0000
+++ b/mysql-test/t/group_by.test 2011-08-30 09:01:05 +0000
@@ -1285,6 +1285,20 @@ FROM t1 GROUP BY a;
DROP TABLE t1;
+--echo #
+--echo # Bug#11765254 (58200): Assertion failed: param.sort_length when grouping
+--echo # by functions
+--echo #
+
+SET BIG_TABLES=1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0),(0);
+SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
+SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
+SELECT 1 FROM t1 GROUP BY SUBSTRING('',SLEEP(0),'');
+SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<');
+DROP TABLE t1;
+SET BIG_TABLES=0;
--echo # End of 5.1 tests
=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc 2011-08-29 08:09:57 +0000
+++ b/sql/filesort.cc 2011-08-30 09:01:05 +0000
@@ -189,8 +189,6 @@ ha_rows filesort(THD *thd, TABLE *table,
table,
thd->variables.max_length_for_sort_data,
max_rows, sort_positions);
- /* filesort cannot handle zero-length records. */
- DBUG_ASSERT(param.sort_length);
table_sort.addon_buf= 0;
table_sort.addon_length= param.addon_length;
@@ -284,6 +282,9 @@ ha_rows filesort(THD *thd, TABLE *table,
}
else
{
+ /* filesort cannot handle zero-length records during merge. */
+ DBUG_ASSERT(param.sort_length != 0);
+
if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer)
{
my_free(table_sort.buffpek);
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (norvald.ryeng:3419 to 3420) | Norvald H. Ryeng | 30 Aug |