mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
a07e48eca0
Added more DBUG statements Ensure that we are comparing end space with BINARY strings Use 'any_db' instead of '' to mean any database. (For HANDLER command) Only strip ' ' when comparing CHAR, not other space-like characters (like \t) BitKeeper/deleted/.del-ctype_tis620.result-old~3578ceb0b8284685: Delete: mysql-test/r/ctype_tis620.result-old BitKeeper/deleted/.del-ctype_tis620.test-old~ffb1bbd2935d1aba: Delete: mysql-test/t/ctype_tis620.test-old client/mysqlbinlog.cc: Added DBUG statements Added call of my_end() to free all used memory on exit heap/hp_info.c: After merge fixes heap/hp_open.c: After merge fixes include/heap.h: After merge fixes include/m_ctype.h: Use pchar instead of 'int' for character parameters. Added 'my_binary_compare()' include/m_string.h: Fixed wrong define innobase/ibuf/ibuf0ibuf.c: After merge fixes innobase/srv/srv0start.c: After merge fixes mysql-test/r/alter_table.result: Fixed results after merge mysql-test/r/auto_increment.result: Fixed results after merge mysql-test/r/bdb.result: Fixed results after merge mysql-test/r/binary.result: Fixed results after merge mysql-test/r/create.result: Fixed results after merge mysql-test/r/ctype_mb.result: Fixed results after merge mysql-test/r/ctype_tis620.result: Fixed results after merge mysql-test/r/ctype_utf8.result: Fixed results after merge mysql-test/r/delete.result: Fixed results after merge mysql-test/r/func_compress.result: Fixed results after merge mysql-test/r/func_gconcat.result: Fixed results after merge mysql-test/r/func_group.result: Fixed results after merge mysql-test/r/func_str.result: Fixed results after merge mysql-test/r/innodb.result: Fixed results after merge mysql-test/r/insert.result: Fixed results after merge mysql-test/r/insert_select.result: Fixed results after merge mysql-test/r/key.result: Fixed results after merge mysql-test/r/loaddata.result: Fixed results after merge mysql-test/r/lock.result: Fixed results after merge mysql-test/r/myisam.result: Fixed results after merge mysql-test/r/null.result: Fixed results after merge mysql-test/r/null_key.result: Fixed results after merge mysql-test/r/order_by.result: Fixed results after merge mysql-test/r/query_cache.result: Fixed results after merge mysql-test/r/range.result: Fixed results after merge mysql-test/r/rpl_multi_delete.result: Fixed results after merge mysql-test/r/rpl_until.result: Fixed results after merge mysql-test/r/subselect.result: Fixed results after merge mysql-test/r/subselect_innodb.result: Fixed results after merge mysql-test/r/type_blob.result: Fixed results after merge mysql-test/r/type_datetime.result: Fixed results after merge mysql-test/r/type_decimal.result: Fixed results after merge mysql-test/r/type_enum.result: Fixed results after merge mysql-test/r/type_float.result: Fixed results after merge mysql-test/r/type_ranges.result: Fixed results after merge mysql-test/r/type_time.result: Fixed results after merge mysql-test/r/type_timestamp.result: Fixed results after merge mysql-test/r/type_uint.result: Fixed results after merge mysql-test/r/type_year.result: Fixed results after merge mysql-test/r/variables.result: Fixed results after merge mysql-test/r/warnings.result: Fixed results after merge mysql-test/t/case.test: Fixed shifted error messages mysql-test/t/create.test: Fixed shifted error messages mysql-test/t/ctype_collate.test: Fixed shifted error messages mysql-test/t/ctype_tis620.test: Merge with 4.0 ctype_tis620 test mysql-test/t/delete.test: Fixed shifted error messages mysql-test/t/derived.test: Fixed shifted error messages mysql-test/t/fulltext.test: Fixed shifted error messages mysql-test/t/func_in.test: Fixed shifted error messages mysql-test/t/func_str.test: Fixed shifted error messages mysql-test/t/func_test.test: Fixed shifted error messages mysql-test/t/grant.test: Fixed shifted error messages mysql-test/t/innodb.test: Change to 4.1 syntax mysql-test/t/key_cache.test: Fixed shifted error messages mysql-test/t/myisam.test: New test of blob and end space mysql-test/t/row.test: Fixed shifted error messages mysql-test/t/rpl_until.test: Fixed shifted error messages mysql-test/t/subselect.test: Fixed shifted error messages mysql-test/t/subselect_innodb.test: Fix test to take into account foreign key constraints mysql-test/t/union.test: Fixed shifted error messages mysql-test/t/user_var.test: Fixed shifted error messages mysql-test/t/variables.test: Fixed shifted error messages mysys/my_handler.c: Merge with 4.0 code sql/ha_heap.cc: After merge fixes sql/handler.cc: After merge fixes sql/item.cc: After merge fixes sql/item_cmpfunc.cc: Ensure that we are comparing end space with BINARY strings sql/item_cmpfunc.h: Ensure that we are comparing end space with BINARY strings sql/log_event.cc: More DBUG statements Ensure that we use all options to LOAD DATA in replication sql/opt_range.cc: After merge fixes sql/sql_db.cc: After merge fixes sql/sql_handler.cc: After merge fixes Use 'any_db' instead of '' to mean 'no database comparison' sql/sql_parse.cc: After merge fixes sql/sql_select.cc: After merge fixes Added function comment for setup_group() sql/sql_string.cc: Added stringcmp() for binary comparison. Added function comments for sortcmp() and stringcmp() sql/sql_string.h: Added stringcmp() sql/sql_table.cc: After merge fixes sql/sql_update.cc: After merge fixes sql/sql_yacc.yy: Use 'any_db' instead of '' to mean any database. Using "" causes a 'wrong db name' error. strings/ctype-big5.c: Strip only end space, not other space characters. strings/ctype-bin.c: Removed some not needed functions. Added function comments Don't remove end space in comparisons Change my_wildcmp_bin() to be 'identical' with other similar code strings/ctype-czech.c: Strip only end space, not other space characters. strings/ctype-gbk.c: Strip only end space, not other space characters. strings/ctype-latin1.c: Strip only end space, not other space characters. strings/ctype-mb.c: Strip only end space, not other space characters. strings/ctype-simple.c: Strip only end space, not other space characters. strings/ctype-sjis.c: Strip only end space, not other space characters. strings/ctype-tis620.c: Added usage of my_instr_simple. This needs to be cleaned up! strings/ctype-utf8.c: Strip only end space, not other space characters. strings/ctype-win1250ch.c: Strip only end space, not other space characters. Fixed indentation strings/strto.c: Code cleanup
224 lines
7.2 KiB
Text
224 lines
7.2 KiB
Text
drop table if exists t1, t2;
|
|
create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null);
|
|
insert into t1 values (1,1,"a","a");
|
|
insert into t1 values (2,2,"b","a");
|
|
insert into t1 values (2,3,"c","b");
|
|
insert into t1 values (3,4,"E","a");
|
|
insert into t1 values (3,5,"C","b");
|
|
insert into t1 values (3,6,"D","b");
|
|
insert into t1 values (3,7,"d","d");
|
|
insert into t1 values (3,8,"d","d");
|
|
insert into t1 values (3,9,"D","c");
|
|
select grp,group_concat(c) from t1 group by grp;
|
|
grp group_concat(c)
|
|
1 a
|
|
2 b,c
|
|
3 E,C,D,d,d,D
|
|
explain extended select grp,group_concat(c) from t1 group by grp;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
|
|
Warnings:
|
|
Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(test.t1.c seperator ',') AS `group_concat(c)` from test.t1 group by test.t1.grp
|
|
select grp,group_concat(a,c) from t1 group by grp;
|
|
grp group_concat(a,c)
|
|
1 1a
|
|
2 2b,3c
|
|
3 4E,5C,6D,7d,8d,9D
|
|
select grp,group_concat("(",a,":",c,")") from t1 group by grp;
|
|
grp group_concat("(",a,":",c,")")
|
|
1 (1:a)
|
|
2 (2:b),(3:c)
|
|
3 (4:E),(5:C),(6:D),(7:d),(8:d),(9:D)
|
|
select grp,group_concat(c separator ",") from t1 group by grp;
|
|
grp group_concat(c separator ",")
|
|
1 a
|
|
2 b,c
|
|
3 E,C,D,d,d,D
|
|
select grp,group_concat(c separator "---->") from t1 group by grp;
|
|
grp group_concat(c separator "---->")
|
|
1 a
|
|
2 b---->c
|
|
3 E---->C---->D---->d---->d---->D
|
|
select grp,group_concat(c order by c) from t1 group by grp;
|
|
grp group_concat(c order by c)
|
|
1 a
|
|
2 b,c
|
|
3 C,D,d,d,D,E
|
|
select grp,group_concat(c order by c desc) from t1 group by grp;
|
|
grp group_concat(c order by c desc)
|
|
1 a
|
|
2 c,b
|
|
3 E,D,d,d,D,C
|
|
select grp,group_concat(d order by a) from t1 group by grp;
|
|
grp group_concat(d order by a)
|
|
1 a
|
|
2 a,b
|
|
3 a,b,b,d,d,c
|
|
select grp,group_concat(d order by a desc) from t1 group by grp;
|
|
grp group_concat(d order by a desc)
|
|
1 a
|
|
2 b,a
|
|
3 c,d,d,b,b,a
|
|
select grp,group_concat(a order by a,d+c) from t1 group by grp;
|
|
grp group_concat(a order by a,d+c)
|
|
1 1
|
|
2 2,3
|
|
3 4,5,6,7,8,9
|
|
select grp,group_concat(c order by 1) from t1 group by grp;
|
|
grp group_concat(c order by 1)
|
|
1 a
|
|
2 b,c
|
|
3 C,D,d,d,D,E
|
|
select grp,group_concat(c order by "c") from t1 group by grp;
|
|
grp group_concat(c order by "c")
|
|
1 a
|
|
2 b,c
|
|
3 C,D,d,d,D,E
|
|
select grp,group_concat(distinct c order by c) from t1 group by grp;
|
|
grp group_concat(distinct c order by c)
|
|
1 a
|
|
2 b,c
|
|
3 C,D,E
|
|
select grp,group_concat(distinct c order by c desc) from t1 group by grp;
|
|
grp group_concat(distinct c order by c desc)
|
|
1 a
|
|
2 c,b
|
|
3 E,D,C
|
|
explain extended select grp,group_concat(distinct c order by c desc) from t1 group by grp;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
|
|
Warnings:
|
|
Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c desc)` from test.t1 group by test.t1.grp
|
|
select grp,group_concat(c order by c separator ",") from t1 group by grp;
|
|
grp group_concat(c order by c separator ",")
|
|
1 a
|
|
2 b,c
|
|
3 C,D,d,d,D,E
|
|
select grp,group_concat(c order by c desc separator ",") from t1 group by grp;
|
|
grp group_concat(c order by c desc separator ",")
|
|
1 a
|
|
2 c,b
|
|
3 E,D,d,d,D,C
|
|
select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
|
|
grp group_concat(distinct c order by c separator ",")
|
|
1 a
|
|
2 b,c
|
|
3 C,D,E
|
|
explain extended select grp,group_concat(distinct c order by c separator ",") from t1 group by grp;
|
|
id select_type table type possible_keys key key_len ref rows Extra
|
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 9 Using filesort
|
|
Warnings:
|
|
Note 1003 select high_priority test.t1.grp AS `grp`,group_concat(distinct test.t1.c order by test.t1.c seperator ',') AS `group_concat(distinct c order by c separator ",")` from test.t1 group by test.t1.grp
|
|
select grp,group_concat(distinct c order by c desc separator ",") from t1 group by grp;
|
|
grp group_concat(distinct c order by c desc separator ",")
|
|
1 a
|
|
2 c,b
|
|
3 E,D,C
|
|
select grp,group_concat(c order by grp desc) from t1 group by grp order by grp;
|
|
grp group_concat(c order by grp desc)
|
|
1 a
|
|
2 c,b
|
|
3 D,d,d,D,C,E
|
|
select grp, group_concat(a separator "")+0 from t1 group by grp;
|
|
grp group_concat(a separator "")+0
|
|
1 1
|
|
2 23
|
|
3 456789
|
|
select grp, group_concat(a separator "")+0.0 from t1 group by grp;
|
|
grp group_concat(a separator "")+0.0
|
|
1 1.0
|
|
2 23.0
|
|
3 456789.0
|
|
select grp, ROUND(group_concat(a separator "")) from t1 group by grp;
|
|
grp ROUND(group_concat(a separator ""))
|
|
1 1
|
|
2 23
|
|
3 456789
|
|
drop table t1;
|
|
create table t1 (grp int, c char(10));
|
|
insert into t1 values (1,NULL);
|
|
insert into t1 values (2,"b");
|
|
insert into t1 values (2,NULL);
|
|
insert into t1 values (3,"E");
|
|
insert into t1 values (3,NULL);
|
|
insert into t1 values (3,"D");
|
|
insert into t1 values (3,NULL);
|
|
insert into t1 values (3,NULL);
|
|
insert into t1 values (3,"D");
|
|
insert into t1 values (4,"");
|
|
insert into t1 values (5,NULL);
|
|
select grp,group_concat(c order by c) from t1 group by grp;
|
|
grp group_concat(c order by c)
|
|
1 NULL
|
|
2 b
|
|
3 D,D,E
|
|
4
|
|
5 NULL
|
|
set group_concat_max_len = 5;
|
|
select grp,group_concat(c) from t1 group by grp;
|
|
grp group_concat(c)
|
|
1 NULL
|
|
2 b
|
|
3 D,D,E
|
|
4
|
|
5 NULL
|
|
Warnings:
|
|
Warning 1260 1 line(s) was(were) cut by group_concat()
|
|
show warnings;
|
|
Level Code Message
|
|
Warning 1260 1 line(s) was(were) cut by group_concat()
|
|
set group_concat_max_len = 1024;
|
|
select group_concat(sum(a)) from t1 group by grp;
|
|
ERROR HY000: Invalid use of group function
|
|
select grp,group_concat(c order by 2) from t1 group by grp;
|
|
ERROR 42S22: Unknown column '2' in 'group statement'
|
|
drop table t1;
|
|
create table t1 ( URL_ID int(11), URL varchar(80));
|
|
create table t2 ( REQ_ID int(11), URL_ID int(11));
|
|
insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
|
|
insert into t2 values (1,4), (5,4), (5,5);
|
|
select REQ_ID, Group_Concat(URL) as URL from t1, t2 where
|
|
t2.URL_ID = t1.URL_ID group by REQ_ID;
|
|
REQ_ID URL
|
|
1 X
|
|
5 X,X,X
|
|
select REQ_ID, Group_Concat(URL) as URL, Min(t1.URL_ID) urll,
|
|
Max(t1.URL_ID) urlg from t1, t2 where t2.URL_ID = t1.URL_ID group by REQ_ID;
|
|
REQ_ID URL urll urlg
|
|
1 X 4 4
|
|
5 X,X,X 4 5
|
|
drop table t1;
|
|
drop table t2;
|
|
create table t1 (id int, name varchar(16));
|
|
insert into t1 values (1,'longername'),(1,'evenlongername');
|
|
select ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'without distinct: how it should be' from t1;
|
|
without distinct: how it should be
|
|
1:longername,1:evenlongername
|
|
select distinct ifnull(group_concat(concat(t1.id, ':', t1.name)), 'shortname') as 'with distinct: cutoff at length of shortname' from t1;
|
|
with distinct: cutoff at length of shortname
|
|
1:longername,1:evenlongername
|
|
drop table t1;
|
|
create table t1(id int);
|
|
create table t2(id int);
|
|
insert into t1 values(0),(1);
|
|
select group_concat(t1.id) FROM t1,t2;
|
|
group_concat(t1.id)
|
|
NULL
|
|
drop table t1;
|
|
drop table t2;
|
|
create table t1 (bar varchar(32));
|
|
insert into t1 values('test'),('test2');
|
|
select * from t1 having group_concat(bar)='';
|
|
bar
|
|
drop table t1;
|
|
create table t1 (a int, a1 varchar(10));
|
|
create table t2 (a0 int);
|
|
insert into t1 values (0,"a"),(0,"b"),(1,"c");
|
|
insert into t2 values (1),(2),(3);
|
|
select group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1;
|
|
group_concat(a1 order by (t1.a IN (select a0 from t2)))
|
|
b,a,c
|
|
select group_concat(a1 order by (t1.a)) from t1;
|
|
group_concat(a1 order by (t1.a))
|
|
b,a,c
|
|
drop table t1, t2;
|