~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/t/func_gconcat.test

Removed SCCS references.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
drop table if exists t1, t2;
6
6
--enable_warnings
7
7
 
8
 
create table t1 (grp int, a bigint, c char(10) not null, d char(10) not null);
 
8
create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null);
9
9
insert into t1 values (1,1,"a","a");
10
10
insert into t1 values (2,2,"b","a");
11
11
insert into t1 values (2,3,"c","b");
78
78
 
79
79
# Test variable length
80
80
 
81
 
create table t1 ( URL_ID int, URL varchar(80));
82
 
create table t2 ( REQ_ID int, URL_ID int);
 
81
create table t1 ( URL_ID int(11), URL varchar(80));
 
82
create table t2 ( REQ_ID int(11), URL_ID int(11));
83
83
insert into t1 values (4,'www.host.com'), (5,'www.google.com'),(5,'www.help.com');
84
84
insert into t2 values (1,4), (5,4), (5,5);
85
85
# Make this order independent
131
131
# Problem with GROUP BY (Bug #2695)
132
132
#
133
133
 
134
 
CREATE TABLE t1 (id1 int NOT NULL, id2 int NOT NULL);
 
134
CREATE TABLE t1 (id1 tinyint(4) NOT NULL, id2 tinyint(4) NOT NULL);
135
135
INSERT INTO t1 VALUES (1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(2, 1),(2, 2),(2, 3);
136
 
CREATE TABLE t2 (id1 int NOT NULL);
 
136
CREATE TABLE t2 (id1 tinyint(4) NOT NULL);
137
137
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
138
138
SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 AND t1.id1=1 GROUP BY t1.id1;
139
139
SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1;
267
267
#
268
268
# Bug#10201
269
269
#
270
 
create table t1 (a varchar(255), b varchar(255) );
 
270
create table t1 (a varchar(255) character set cp1250 collate cp1250_general_ci,
 
271
                 b varchar(255) character set koi8r);
271
272
insert into t1 values ('xxx','yyy');
272
273
select collation(a) from t1;
273
274
select collation(group_concat(a)) from t1;
274
275
create table t2 select group_concat(a) as a from t1;
275
276
show create table t2;
 
277
select collation(group_concat(a,_koi8r'test')) from t1;
 
278
--error 1267
 
279
select collation(group_concat(a,_koi8r 0xC1C2)) from t1;
 
280
--error 1267
276
281
select collation(group_concat(a,b)) from t1;
277
282
drop table t1;
278
283
drop table t2;
281
286
# Bug #12829
282
287
# Cannot convert the charset of a GROUP_CONCAT result
283
288
#
284
 
#CREATE TABLE t1 (a VARCHAR(10));
285
 
#INSERT INTO t1 VALUES ('�');
286
 
#SELECT a FROM t1;
287
 
#SELECT GROUP_CONCAT(a) FROM t1;
288
 
#DROP TABLE t1;
 
289
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp850);
 
290
INSERT INTO t1 VALUES ('�');
 
291
SELECT a FROM t1;
 
292
SELECT GROUP_CONCAT(a) FROM t1;
 
293
DROP TABLE t1;
289
294
 
290
295
#
291
296
# bug #7769: group_concat returning null is checked in having
328
333
#
329
334
 
330
335
CREATE TABLE t1 (
331
 
  aID int NOT NULL auto_increment,
332
 
  sometitle varchar(155) NOT NULL default '',
333
 
  bID int NOT NULL,
 
336
  aID smallint(5) unsigned NOT NULL auto_increment,
 
337
  sometitle varchar(255) NOT NULL default '',
 
338
  bID smallint(5) unsigned NOT NULL,
334
339
  PRIMARY KEY  (aID),
335
340
  UNIQUE KEY sometitle (sometitle)
336
341
);
338
343
INSERT INTO t1 SET sometitle = 'title2', bID = 1;
339
344
 
340
345
CREATE TABLE t2 (
341
 
  bID int NOT NULL auto_increment,
342
 
  somename varchar(155) NOT NULL default '',
 
346
  bID smallint(5) unsigned NOT NULL auto_increment,
 
347
  somename varchar(255) NOT NULL default '',
343
348
  PRIMARY KEY  (bID),
344
349
  UNIQUE KEY somename (somename)
345
350
);
392
397
#
393
398
# Bug#14169 type of group_concat() result changed to blob if tmp_table was used
394
399
#
395
 
create table t1 (f1 int, f2 varchar(255));
 
400
create table t1 (f1 int unsigned, f2 varchar(255));
396
401
insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
397
402
--enable_metadata
398
403
select f2,group_concat(f1) from t1 group by f2;
406
411
# returns BLOB": add a test case, the bug can not be repeated any more.
407
412
#
408
413
 
 
414
set names latin1;
409
415
create table t1 (a char, b char);
410
416
insert into t1 values ('a', 'a'), ('a', 'b'), ('b', 'a'), ('b', 'b');
411
417
create table t2 select group_concat(b) as a from t1 where a = 'a';
412
418
create table t3 (select group_concat(a) as a from t1 where a = 'a') union
413
419
                (select group_concat(b) as a from t1 where a = 'b');
 
420
select charset(a) from t2;
 
421
select charset(a) from t3;
414
422
drop table t1, t2, t3;
 
423
set names default;
 
424
 
 
425
#
 
426
# Bug#18281 group_concat changes charset to binary
 
427
#
 
428
create table t1 (c1 varchar(10), c2 int);
 
429
select charset(group_concat(c1 order by c2)) from t1;
 
430
drop table t1;
415
431
 
416
432
#
417
433
# Bug #16712: group_concat returns odd string instead of intended result
418
434
#
419
 
CREATE TABLE t1 (a INT, b LONGTEXT, PRIMARY KEY (a));
 
435
CREATE TABLE t1 (a INT(10), b LONGTEXT, PRIMARY KEY (a));
420
436
 
421
437
SET GROUP_CONCAT_MAX_LEN = 20000000;
422
438
 
445
461
#
446
462
# Bug#23451 GROUP_CONCAT truncates a multibyte utf8 character
447
463
#
 
464
set names utf8;
448
465
create table t1
449
466
(
450
 
  x text not null,
 
467
  x text character set utf8 not null,
451
468
  y integer not null
452
469
);
453
470
insert into t1 values (repeat('a', 1022), 0), (repeat(_utf8 0xc3b7, 4), 0);
463
480
}
464
481
drop table t1;
465
482
set group_concat_max_len=1024;
 
483
set names latin1;
466
484
 
467
485
#
468
486
# Bug#14169 type of group_concat() result changed to blob if tmp_table was used
469
487
#
470
 
create table t1 (f1 int, f2 varchar(255));
 
488
create table t1 (f1 int unsigned, f2 varchar(255));
471
489
insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
472
490
--enable_metadata
473
491
select f2,group_concat(f1) from t1 group by f2;
532
550
# Bug#29850: Wrong charset of the GROUP_CONCAT result when the select employs
533
551
#            a temporary table.
534
552
#
535
 
#create table t1 (id int, name varchar(20));
536
 
#insert into t1 (id, name) values (1, "�ra");
537
 
#insert into t1 (id, name) values (2, "�ra");
538
 
#select b.id, group_concat(b.name) from t1 a, t1 b group by b.id;
539
 
#drop table t1;
 
553
set names latin1;
 
554
create table t1 (id int, name varchar(20)) DEFAULT CHARSET=utf8;
 
555
insert into t1 (id, name) values (1, "�ra");
 
556
insert into t1 (id, name) values (2, "�ra");
 
557
select b.id, group_concat(b.name) from t1 a, t1 b group by b.id;
 
558
drop table t1;
 
559
 
 
560
#
 
561
# Bug #31154: group_concat() and bit fields;
 
562
#
 
563
create table t1(a bit not null default 0);
 
564
insert into t1 values (), (), ();
 
565
select group_concat(distinct a) from t1;
 
566
select group_concat(distinct a order by a) from t1;
 
567
drop table t1;
 
568
 
 
569
create table t1(a bit(2) not null);
 
570
insert into t1 values (1), (0), (0), (3), (1);
 
571
select group_concat(distinct a) from t1;
 
572
select group_concat(distinct a order by a) from t1;
 
573
select group_concat(distinct a order by a desc) from t1;
 
574
drop table t1;
 
575
 
 
576
create table t1(a bit(2), b varchar(10), c bit);
 
577
insert into t1 values (1, 'a', 0), (0, 'b', 1), (0, 'c', 0), (3, 'd', 1),
 
578
(1, 'e', 1), (3, 'f', 1), (0, 'g', 1);
 
579
select group_concat(distinct a, c) from t1;
 
580
select group_concat(distinct a, c order by a) from t1;
 
581
select group_concat(distinct a, c) from t1;
 
582
select group_concat(distinct a, c order by a, c) from t1;
 
583
select group_concat(distinct a, c order by a desc, c desc) from t1;
 
584
 
 
585
drop table t1;
 
586
 
540
587
 
541
588
#
542
589
# Bug#30897 GROUP_CONCAT returns extra comma on empty fields