~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/user_var.test

  • Committer: Monty Taylor
  • Date: 2008-10-10 23:04:21 UTC
  • mto: (509.1.1 codestyle)
  • mto: This revision was merged to the branch mainline in revision 511.
  • Revision ID: monty@inaugust.com-20081010230421-zohe1eppxievpw8d
Removed O_NOFOLLOW

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 ER_BAD_FIELD_ERROR
 
6
--error 1054
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
#
80
107
# Bug #6321 strange error:
81
108
#   string function FIELD(<uservariable content NULL>, ...)
82
109
#
84
111
select FIELD( @var,'1it','Hit') as my_column;
85
112
 
86
113
#
 
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
#
87
121
# Bug #9286  SESSION/GLOBAL should be disallowed for user variables
88
122
#
89
 
--error ER_PARSE_ERROR
 
123
--error 1064
90
124
set session @honk=99;
 
125
--error 1382
 
126
set one_shot @honk=99;
91
127
 
92
128
#
93
129
# Bug #10724  @@local not preserved in column name of select
115
151
 
116
152
set @first_var= NULL;
117
153
create table t1 select @first_var;
118
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
119
 
show create table t1;
120
 
drop table t1;
121
 
 
122
 
# This is not supported by Drizzle
123
 
--error ER_PARSE_ERROR
124
 
set @first_var= cast(NULL as integer);
125
 
#create table t1 select @first_var;
126
 
#--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
127
 
#show create table t1;
128
 
#drop table t1;
129
 
 
 
154
show create table t1;
 
155
drop table t1;
 
156
set @first_var= cast(NULL as signed integer);
 
157
create table t1 select @first_var;
 
158
show create table t1;
 
159
drop table t1;
130
160
set @first_var= NULL;
131
161
create table t1 select @first_var;
132
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
133
162
show create table t1;
134
163
drop table t1;
135
164
set @first_var= concat(NULL);
136
165
create table t1 select @first_var;
137
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
138
166
show create table t1;
139
167
drop table t1;
140
168
set @first_var=1;
141
169
set @first_var= cast(NULL as CHAR);
142
170
create table t1 select @first_var;
143
 
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
144
171
show create table t1;
145
172
drop table t1;
146
173
 
163
190
select * from bigfailure where afield = (SELECT afield FROM bigfailure);
164
191
select * from bigfailure where afield = 18446744071710965857;
165
192
# This is fixed in 5.0, to be uncommented there
166
 
select * from bigfailure where afield = '18446744071710965857';
 
193
#select * from bigfailure where afield = '18446744071710965857';
167
194
select * from bigfailure where afield = 18446744071710965856+1;
168
195
 
169
196
SET @a := (SELECT afield FROM bigfailure);
183
210
insert into t1 values (1,2),(2,3),(3,1);
184
211
select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
185
212
select @var;
186
 
# Bug 310977, uncomment this test after the bug is fixed
187
 
#create table t2 as select @var:=f2 from t1 group by f1 order by f2 desc limit 1;
188
 
#select * from t2;
189
 
#select @var;
190
 
drop table t1;
191
 
#drop table t2;
 
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;
192
217
 
193
218
#
194
219
# Bug#19024 - SHOW COUNT(*) WARNINGS not return Errors 
195
220
#
196
 
--error ER_PARSE_ERROR
 
221
--error 1064
197
222
insert into city 'blah';
198
223
SHOW COUNT(*) WARNINGS;
199
224
SHOW COUNT(*) ERRORS;