~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/user_var.test

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
drop table if exists t1,t2;
4
4
--enable_warnings
5
5
 
6
 
--error 1054
 
6
--error ER_BAD_FIELD_ERROR
7
7
set @a := foo;
8
8
set @a := connection_id() + 3;
9
9
select @a - connection_id();
77
77
drop table t1;
78
78
 
79
79
#
80
 
# Bug #2244: User variables didn't copy collation and derivation
81
 
# attributes from values they were initialized to.
82
 
#
83
 
 
84
 
set @a=_latin2'test';
85
 
select charset(@a),collation(@a),coercibility(@a);
86
 
select @a=_latin2'TEST';
87
 
select @a=_latin2'TEST' collate latin2_bin;
88
 
 
89
 
set @a=_latin2'test' collate latin2_general_ci;
90
 
select charset(@a),collation(@a),coercibility(@a);
91
 
select @a=_latin2'TEST';
92
 
select @a=_latin2'TEST' collate latin2_bin;
93
 
 
94
 
#
95
 
# Check the same invoking Item_set_user_var
96
 
#
97
 
select charset(@a:=_latin2'test');
98
 
select collation(@a:=_latin2'test');
99
 
select coercibility(@a:=_latin2'test');
100
 
select collation(@a:=_latin2'test' collate latin2_bin);
101
 
select coercibility(@a:=_latin2'test' collate latin2_bin);
102
 
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
103
 
select charset(@a),collation(@a),coercibility(@a);
104
 
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
105
 
 
106
 
#
107
80
# Bug #6321 strange error:
108
81
#   string function FIELD(<uservariable content NULL>, ...)
109
82
#
111
84
select FIELD( @var,'1it','Hit') as my_column;
112
85
 
113
86
#
114
 
# Bug#9425 A user variable doesn't always have implicit coercibility
115
 
#
116
 
select @v, coercibility(@v);
117
 
set @v1=null, @v2=1, @v3=1.1, @v4=now();
118
 
select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4);
119
 
 
120
 
#
121
87
# Bug #9286  SESSION/GLOBAL should be disallowed for user variables
122
88
#
123
 
--error 1064
 
89
--error ER_PARSE_ERROR
124
90
set session @honk=99;
125
 
--error 1382
126
 
set one_shot @honk=99;
127
91
 
128
92
#
129
93
# Bug #10724  @@local not preserved in column name of select
151
115
 
152
116
set @first_var= NULL;
153
117
create table t1 select @first_var;
 
118
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
154
119
show create table t1;
155
120
drop table t1;
156
 
set @first_var= cast(NULL as signed integer);
 
121
 
 
122
set @first_var= cast(NULL as integer);
 
123
 
157
124
create table t1 select @first_var;
 
125
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
158
126
show create table t1;
159
127
drop table t1;
 
128
 
160
129
set @first_var= NULL;
161
130
create table t1 select @first_var;
 
131
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
162
132
show create table t1;
163
133
drop table t1;
164
134
set @first_var= concat(NULL);
165
135
create table t1 select @first_var;
 
136
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
166
137
show create table t1;
167
138
drop table t1;
168
139
set @first_var=1;
169
140
set @first_var= cast(NULL as CHAR);
170
141
create table t1 select @first_var;
 
142
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
171
143
show create table t1;
172
144
drop table t1;
173
145
 
182
154
# Second part, set user var from large number in table
183
155
# then select it
184
156
CREATE TABLE `bigfailure` (
185
 
  `afield` BIGINT NOT NULL
 
157
  `afield` BIGINT UNSIGNED NOT NULL
186
158
);
187
159
INSERT INTO `bigfailure` VALUES (18446744071710965857);
188
160
SELECT * FROM bigfailure;
190
162
select * from bigfailure where afield = (SELECT afield FROM bigfailure);
191
163
select * from bigfailure where afield = 18446744071710965857;
192
164
# This is fixed in 5.0, to be uncommented there
193
 
#select * from bigfailure where afield = '18446744071710965857';
 
165
select * from bigfailure where afield = '18446744071710965857';
194
166
select * from bigfailure where afield = 18446744071710965856+1;
195
167
 
196
168
SET @a := (SELECT afield FROM bigfailure);
210
182
insert into t1 values (1,2),(2,3),(3,1);
211
183
select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
212
184
select @var;
213
 
create table t2 as select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
214
 
select * from t2;
215
 
select @var;
216
 
drop table t1,t2;
 
185
# Bug 310977, uncomment this test after the bug is fixed
 
186
#create table t2 as select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
 
187
#select * from t2;
 
188
#select @var;
 
189
drop table t1;
 
190
#drop table t2;
217
191
 
218
192
#
219
193
# Bug#19024 - SHOW COUNT(*) WARNINGS not return Errors 
220
194
#
221
 
--error 1064
 
195
--error ER_PARSE_ERROR
222
196
insert into city 'blah';
223
197
SHOW COUNT(*) WARNINGS;
224
198
SHOW COUNT(*) ERRORS;