~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

Viewing changes to tests/t/func_concat.test

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Test of problem with CONCAT_WS() and long separators.
 
3
#
 
4
 
 
5
--disable_warnings
 
6
DROP TABLE IF EXISTS t1;
 
7
--enable_warnings
 
8
 
 
9
CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL );
 
10
INSERT INTO t1 VALUES (1413006,'idlfmv'),
 
11
(1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd');
 
12
 
 
13
SELECT number, alpha, CONCAT_WS('<---->',number,alpha) AS new
 
14
FROM t1 GROUP BY number;
 
15
 
 
16
SELECT CONCAT_WS('<---->',number,alpha) AS new
 
17
FROM t1 GROUP BY new LIMIT 1;
 
18
 
 
19
SELECT number, alpha, CONCAT_WS('<->',number,alpha) AS new
 
20
FROM t1 GROUP BY new LIMIT 1;
 
21
 
 
22
SELECT number, alpha, CONCAT_WS('-',number,alpha,alpha,alpha,alpha,alpha,alpha,alpha) AS new
 
23
FROM t1 GROUP BY new LIMIT 1;
 
24
 
 
25
SELECT number, alpha, CONCAT_WS('<------------------>',number,alpha) AS new
 
26
FROM t1 GROUP BY new LIMIT 1;
 
27
drop table t1;
 
28
 
 
29
#
 
30
# Bug #5540: a problem with double type
 
31
#
 
32
 
 
33
create table t1 (a char(4), b double, c date, d int);
 
34
insert into t1 values ('AAAA', 105, '2003-03-01', 1);
 
35
select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
 
36
drop table t1;
 
37
 
 
38
# BUG#6825 
 
39
select 'a' union select concat('a', -4);
 
40
select 'a' union select concat('a', -4.5);
 
41
 
 
42
select 'a' union select concat('a', -(4 + 1));
 
43
select 'a' union select concat('a', 4 - 5);
 
44
 
 
45
select 'a' union select concat('a', -'3');
 
46
select 'a' union select concat('a', -concat('3',4));
 
47
 
 
48
select 'a' union select concat('a', -0);
 
49
--replace_result a-0.0 a0.0
 
50
select 'a' union select concat('a', -0.0);
 
51
 
 
52
--replace_result a-0.0000 a0.0000
 
53
select 'a' union select concat('a', -0.0000);
 
54
 
 
55
#
 
56
# Bug#16716: subselect in concat() may lead to a wrong result
 
57
#
 
58
select concat((select x from (select 'a' as x) as t1 ),
 
59
  (select y from (select 'b' as y) as t2 )) from (select 1 union select 2 )
 
60
  as t3;
 
61
 
 
62
# End of 4.1 tests
 
63
 
 
64
#
 
65
# Bug#15962: CONCAT() in UNION may lead to a data trucation.
 
66
#
 
67
create table t1(f1 varchar(6));
 
68
insert into t1 values ("123456");
 
69
select concat(f1, 2) a from t1 union select 'x' a from t1;
 
70
drop table t1;