Loading mysql-test/r/view.result +23 −0 Original line number Diff line number Diff line Loading @@ -2024,3 +2024,26 @@ f1 sb 2005-01-01 12:00:00 2005-01-01 10:58:59 drop view v1; drop table t1; CREATE TABLE t1 ( aid int PRIMARY KEY, fn varchar(20) NOT NULL, ln varchar(20) NOT NULL ); CREATE TABLE t2 ( aid int NOT NULL, pid int NOT NULL ); INSERT INTO t1 VALUES(1,'a','b'), (2,'c','d'); INSERT INTO t2 values (1,1), (2,1), (2,2); CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid; SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2 WHERE t1.aid = t2.aid GROUP BY pid; pid GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) 1 a b,c d 2 c d SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid; pid GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) 1 a b,c d 2 c d DROP VIEW v1; DROP TABLE t1,t2; mysql-test/t/view.test +25 −1 Original line number Diff line number Diff line Loading @@ -1863,3 +1863,27 @@ create view v1 as select f1, subtime(f1, '1:1:1') as sb from t1; select * from v1; drop view v1; drop table t1; # # Test for bug #11412: query over a multitable view with GROUP_CONCAT # CREATE TABLE t1 ( aid int PRIMARY KEY, fn varchar(20) NOT NULL, ln varchar(20) NOT NULL ); CREATE TABLE t2 ( aid int NOT NULL, pid int NOT NULL ); INSERT INTO t1 VALUES(1,'a','b'), (2,'c','d'); INSERT INTO t2 values (1,1), (2,1), (2,2); CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid; SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2 WHERE t1.aid = t2.aid GROUP BY pid; SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid; DROP VIEW v1; DROP TABLE t1,t2; mysys/charset.c +18 −16 Original line number Diff line number Diff line Loading @@ -383,7 +383,8 @@ static my_bool init_available_charsets(myf myflags) while we may changing the cs_info_table */ pthread_mutex_lock(&THR_LOCK_charset); if (!charset_initialized) { bzero(&all_charsets,sizeof(all_charsets)); init_compiled_charsets(myflags); Loading @@ -403,6 +404,7 @@ static my_bool init_available_charsets(myf myflags) strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); error= my_read_charset_file(fname,myflags); charset_initialized=1; } pthread_mutex_unlock(&THR_LOCK_charset); } return error; Loading sql/item.h +8 −2 Original line number Diff line number Diff line Loading @@ -1473,7 +1473,13 @@ class Item_ref :public Item_ident void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); } enum Item_result result_type () const { return (*ref)->result_type(); } enum_field_types field_type() const { return (*ref)->field_type(); } Field *get_tmp_table_field() { return result_field; } Field *get_tmp_table_field() { return result_field ? result_field : (*ref)->get_tmp_table_field(); } Item *get_tmp_table_item(THD *thd) { return (result_field ? new Item_field(result_field) : (*ref)->get_tmp_table_item(thd)); } table_map used_tables() const { return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables(); Loading sql/item_buff.cc +3 −3 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ Cached_item *new_Cached_item(THD *thd, Item *item) { if (item->type() == Item::FIELD_ITEM && !(((Item_field *) item)->field->flags & BLOB_FLAG)) return new Cached_item_field((Item_field *) item); if (item->real_item()->type() == Item::FIELD_ITEM && !(((Item_field *) (item->real_item()))->field->flags & BLOB_FLAG)) return new Cached_item_field((Item_field *) (item->real_item())); switch (item->result_type()) { case STRING_RESULT: return new Cached_item_str(thd, (Item_field *) item); Loading Loading
mysql-test/r/view.result +23 −0 Original line number Diff line number Diff line Loading @@ -2024,3 +2024,26 @@ f1 sb 2005-01-01 12:00:00 2005-01-01 10:58:59 drop view v1; drop table t1; CREATE TABLE t1 ( aid int PRIMARY KEY, fn varchar(20) NOT NULL, ln varchar(20) NOT NULL ); CREATE TABLE t2 ( aid int NOT NULL, pid int NOT NULL ); INSERT INTO t1 VALUES(1,'a','b'), (2,'c','d'); INSERT INTO t2 values (1,1), (2,1), (2,2); CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid; SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2 WHERE t1.aid = t2.aid GROUP BY pid; pid GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) 1 a b,c d 2 c d SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid; pid GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) 1 a b,c d 2 c d DROP VIEW v1; DROP TABLE t1,t2;
mysql-test/t/view.test +25 −1 Original line number Diff line number Diff line Loading @@ -1863,3 +1863,27 @@ create view v1 as select f1, subtime(f1, '1:1:1') as sb from t1; select * from v1; drop view v1; drop table t1; # # Test for bug #11412: query over a multitable view with GROUP_CONCAT # CREATE TABLE t1 ( aid int PRIMARY KEY, fn varchar(20) NOT NULL, ln varchar(20) NOT NULL ); CREATE TABLE t2 ( aid int NOT NULL, pid int NOT NULL ); INSERT INTO t1 VALUES(1,'a','b'), (2,'c','d'); INSERT INTO t2 values (1,1), (2,1), (2,2); CREATE VIEW v1 AS SELECT t1.*,t2.pid FROM t1,t2 WHERE t1.aid = t2.aid; SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM t1,t2 WHERE t1.aid = t2.aid GROUP BY pid; SELECT pid,GROUP_CONCAT(CONCAT(fn,' ',ln) ORDER BY 1) FROM v1 GROUP BY pid; DROP VIEW v1; DROP TABLE t1,t2;
mysys/charset.c +18 −16 Original line number Diff line number Diff line Loading @@ -383,7 +383,8 @@ static my_bool init_available_charsets(myf myflags) while we may changing the cs_info_table */ pthread_mutex_lock(&THR_LOCK_charset); if (!charset_initialized) { bzero(&all_charsets,sizeof(all_charsets)); init_compiled_charsets(myflags); Loading @@ -403,6 +404,7 @@ static my_bool init_available_charsets(myf myflags) strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); error= my_read_charset_file(fname,myflags); charset_initialized=1; } pthread_mutex_unlock(&THR_LOCK_charset); } return error; Loading
sql/item.h +8 −2 Original line number Diff line number Diff line Loading @@ -1473,7 +1473,13 @@ class Item_ref :public Item_ident void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); } enum Item_result result_type () const { return (*ref)->result_type(); } enum_field_types field_type() const { return (*ref)->field_type(); } Field *get_tmp_table_field() { return result_field; } Field *get_tmp_table_field() { return result_field ? result_field : (*ref)->get_tmp_table_field(); } Item *get_tmp_table_item(THD *thd) { return (result_field ? new Item_field(result_field) : (*ref)->get_tmp_table_item(thd)); } table_map used_tables() const { return depended_from ? OUTER_REF_TABLE_BIT : (*ref)->used_tables(); Loading
sql/item_buff.cc +3 −3 Original line number Diff line number Diff line Loading @@ -25,9 +25,9 @@ Cached_item *new_Cached_item(THD *thd, Item *item) { if (item->type() == Item::FIELD_ITEM && !(((Item_field *) item)->field->flags & BLOB_FLAG)) return new Cached_item_field((Item_field *) item); if (item->real_item()->type() == Item::FIELD_ITEM && !(((Item_field *) (item->real_item()))->field->flags & BLOB_FLAG)) return new Cached_item_field((Item_field *) (item->real_item())); switch (item->result_type()) { case STRING_RESULT: return new Cached_item_str(thd, (Item_field *) item); Loading