Commit 1e3a4dc1 authored by Georgi Kodinov's avatar Georgi Kodinov

merge

parents d74e8c5d 9da97a67
perl mysql-test-run.pl --timer --force --comment=n_stm perl mysql-test-run.pl --timer --force --vardir=var-n_stm --comment=n_stm
perl mysql-test-run.pl --timer --force --comment=ps_stm --ps-protocol perl mysql-test-run.pl --timer --force --vardir=var-ps_stm --comment=ps_stm --ps-protocol
#
# Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata"
#
# Queries such as SHOW TABLE STATUS and SELECT * FROM INFORMATION_SCHEMA.TABLES fail
# when encountering a federated table that cannot connect to its remote table.
#
# The fix is to store the error text in the TABLE COMMENTS column of I_S.TABLES, clear
# the remote connection error and push a warning instead. This allows the SELECT operation
# to complete while still indicating a problem. This fix applies to any non-fatal system
# error that occurs during a query against I_S.TABLES.de
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
DROP DATABASE IF EXISTS federated;
CREATE DATABASE federated;
CREATE DATABASE IF NOT EXISTS realdb;
DROP TABLE IF EXISTS realdb.t0;
DROP TABLE IF EXISTS federated.t0;
#
# Create the base table to be referenced
#
CREATE TABLE realdb.t0 (a text, b text) ENGINE=MYISAM;
#
# Create a federated table with a bogus port number
#
CREATE TABLE federated.t0 (a text, b text) ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:63333/realdb/t0';
#
# Trigger a federated system error during a INFORMATION_SCHEMA.TABLES query
#
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'realdb' or TABLE_SCHEMA = 'federated';
TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT
federated t0 NULL NULL NULL NULL Unable to connect to foreign data source: Can't connect to MySQL server on '127.
realdb t0 BASE TABLE MyISAM Dynamic 0 0
Warnings:
Warning 1429 Unable to connect to foreign data source: Can't connect to MySQL server on '127.0.0.1' (socket errno)
SHOW WARNINGS;
Level Code Message
Warning 1429 Unable to connect to foreign data source: Can't connect to MySQL server on '127.0.0.1' (socket errno)
#
# Create a MyISAM table then corrupt the file
#
USE realdb;
CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
#
# Corrupt the MyISAM table by deleting the base file
#
#
# Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
#
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_ROWS DATA_LENGTH TABLE_COMMENT
realdb t1 BASE TABLE NULL NULL NULL NULL Can't find file: 't1' (errno: 2)
Warnings:
Warning 1017 Can't find file: 't1' (errno: 2)
SHOW WARNINGS;
Level Code Message
Warning 1017 Can't find file: 't1' (errno: 2)
#
# Cleanup
#
DROP TABLE IF EXISTS realdb.t0;
DROP TABLE IF EXISTS federated.t0;
DROP DATABASE realdb;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE IF EXISTS federated;
...@@ -989,4 +989,22 @@ SELECT 1 FROM ...@@ -989,4 +989,22 @@ SELECT 1 FROM
1 1
1 1
DROP TABLE t1; DROP TABLE t1;
#
# Bug #54476: crash when group_concat and 'with rollup' in prepared statements
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
EXECUTE stmt;
GROUP_CONCAT(t1.a ORDER BY t1.a)
1,1
2,2
1,1,2,2
EXECUTE stmt;
GROUP_CONCAT(t1.a ORDER BY t1.a)
1,1
2,2
1,1,2,2
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
End of 5.0 tests End of 5.0 tests
...@@ -1053,6 +1053,8 @@ select table_type from information_schema.tables ...@@ -1053,6 +1053,8 @@ select table_type from information_schema.tables
where table_name="v1"; where table_name="v1";
table_type table_type
VIEW VIEW
Warnings:
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1; drop view v1;
create temporary table t1(f1 int, index(f1)); create temporary table t1(f1 int, index(f1));
show columns from t1; show columns from t1;
......
...@@ -65,10 +65,14 @@ select table_name, table_type, table_comment from information_schema.tables ...@@ -65,10 +65,14 @@ select table_name, table_type, table_comment from information_schema.tables
where table_schema='inf%' and func2(); where table_schema='inf%' and func2();
table_name table_type table_comment table_name table_type table_comment
v1 VIEW View 'inf%.v1' references invalid table(s) or column(s) or function(s) or define v1 VIEW View 'inf%.v1' references invalid table(s) or column(s) or function(s) or define
Warnings:
Warning 1356 View 'inf%.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
select table_name, table_type, table_comment from information_schema.tables select table_name, table_type, table_comment from information_schema.tables
where table_schema='inf%' and func2(); where table_schema='inf%' and func2();
table_name table_type table_comment table_name table_type table_comment
v1 VIEW View 'inf%.v1' references invalid table(s) or column(s) or function(s) or define v1 VIEW View 'inf%.v1' references invalid table(s) or column(s) or function(s) or define
Warnings:
Warning 1356 View 'inf%.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1; drop view v1;
drop function func1; drop function func1;
drop function func2; drop function func2;
......
...@@ -622,6 +622,8 @@ flush tables; ...@@ -622,6 +622,8 @@ flush tables;
SHOW TABLE STATUS like 't1'; SHOW TABLE STATUS like 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm' t1 NULL NULL NULL NULL # # # # NULL NULL NULL NULL NULL NULL NULL NULL Incorrect information in file: './test/t1.frm'
Warnings:
Warning 1033 Incorrect information in file: './test/t1.frm'
show create table t1; show create table t1;
ERROR HY000: Incorrect information in file: './test/t1.frm' ERROR HY000: Incorrect information in file: './test/t1.frm'
drop table t1; drop table t1;
......
...@@ -840,6 +840,8 @@ show table status; ...@@ -840,6 +840,8 @@ show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL View 'test.v1' references invalid table(s) or column(s) or function(s) or define v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL View 'test.v1' references invalid table(s) or column(s) or function(s) or define
Warnings:
Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v1; drop view v1;
drop table t1; drop table t1;
create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1; create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
......
--echo #
--echo # Bug 35333 "If a Federated table can't connect to the remote hose, can't retrieve metadata"
--echo #
--echo # Queries such as SHOW TABLE STATUS and SELECT * FROM INFORMATION_SCHEMA.TABLES fail
--echo # when encountering a federated table that cannot connect to its remote table.
--echo #
--echo # The fix is to store the error text in the TABLE COMMENTS column of I_S.TABLES, clear
--echo # the remote connection error and push a warning instead. This allows the SELECT operation
--echo # to complete while still indicating a problem. This fix applies to any non-fatal system
--echo # error that occurs during a query against I_S.TABLES.de
--source include/federated.inc
--disable_warnings
CREATE DATABASE IF NOT EXISTS realdb;
# Federated database exists
DROP TABLE IF EXISTS realdb.t0;
DROP TABLE IF EXISTS federated.t0;
--enable_warnings
--echo #
--echo # Create the base table to be referenced
--echo #
CREATE TABLE realdb.t0 (a text, b text) ENGINE=MYISAM;
--echo #
--echo # Create a federated table with a bogus port number
--echo #
CREATE TABLE federated.t0 (a text, b text) ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:63333/realdb/t0';
#--warning ER_CONNECT_TO_FOREIGN_DATA_SOURCE
--echo #
--echo # Trigger a federated system error during a INFORMATION_SCHEMA.TABLES query
--echo #
# Remove O/S-specific socket error
--replace_regex /\(.*\)/(socket errno)/
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'realdb' or TABLE_SCHEMA = 'federated';
# Remove O/S-specific socket error
--replace_regex /\(.*\)/(socket errno)/
SHOW WARNINGS;
--echo #
--echo # Create a MyISAM table then corrupt the file
--echo #
USE realdb;
CREATE TABLE t1 (c1 int) ENGINE=MYISAM;
--echo #
--echo # Corrupt the MyISAM table by deleting the base file
--echo #
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--remove_file $MYSQLD_DATADIR/realdb/t1.MYD
--remove_file $MYSQLD_DATADIR/realdb/t1.MYI
--echo #
--echo # Trigger a MyISAM system error during an INFORMATION_SCHEMA.TABLES query
--echo #
SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, ROW_FORMAT, TABLE_ROWS, DATA_LENGTH, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
SHOW WARNINGS;
--echo #
--echo # Cleanup
--echo #
--disable_warnings
DROP TABLE IF EXISTS realdb.t0;
DROP TABLE IF EXISTS federated.t0;
DROP DATABASE realdb;
--enable_warnings
--source include/federated_cleanup.inc
...@@ -708,4 +708,18 @@ SELECT 1 FROM ...@@ -708,4 +708,18 @@ SELECT 1 FROM
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #54476: crash when group_concat and 'with rollup' in prepared statements
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2);
PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -3170,7 +3170,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, ...@@ -3170,7 +3170,6 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
tree(item->tree), tree(item->tree),
unique_filter(item->unique_filter), unique_filter(item->unique_filter),
table(item->table), table(item->table),
order(item->order),
context(item->context), context(item->context),
arg_count_order(item->arg_count_order), arg_count_order(item->arg_count_order),
arg_count_field(item->arg_count_field), arg_count_field(item->arg_count_field),
...@@ -3183,6 +3182,24 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, ...@@ -3183,6 +3182,24 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
{ {
quick_group= item->quick_group; quick_group= item->quick_group;
result.set_charset(collation.collation); result.set_charset(collation.collation);
/*
Since the ORDER structures pointed to by the elements of the 'order' array
may be modified in find_order_in_list() called from
Item_func_group_concat::setup(), create a copy of those structures so that
such modifications done in this object would not have any effect on the
object being copied.
*/
ORDER *tmp;
if (!(order= (ORDER **) thd->alloc(sizeof(ORDER *) * arg_count_order +
sizeof(ORDER) * arg_count_order)))
return;
tmp= (ORDER *)(order + arg_count_order);
for (uint i= 0; i < arg_count_order; i++, tmp++)
{
memcpy(tmp, item->order[i], sizeof(ORDER));
order[i]= tmp;
}
} }
......
This diff is collapsed.
...@@ -31,7 +31,6 @@ typedef struct st_order { ...@@ -31,7 +31,6 @@ typedef struct st_order {
struct st_order *next; struct st_order *next;
Item **item; /* Point at item in select fields */ Item **item; /* Point at item in select fields */
Item *item_ptr; /* Storage for initial item */ Item *item_ptr; /* Storage for initial item */
Item **item_copy; /* For SPs; the original item ptr */
int counter; /* position in SELECT list, correct int counter; /* position in SELECT list, correct
only if counter_used is true*/ only if counter_used is true*/
bool asc; /* true if ascending */ bool asc; /* true if ascending */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment