mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 21:42:35 +01:00
5a3c12effb
BitKeeper/etc/logging_ok: auto-union sql/item_func.cc: Auto merged mysql-test/t/user_var.test: Auto merged sql/log_event.cc: Auto merged sql/log_event.h: Auto merged sql/nt_servc.cc: Auto merged configure.in: Use local version innobase/os/os0file.c: Use local version innobase/page/page0page.c: Use local version innobase/row/row0sel.c: Use local version innobase/row/row0vers.c: Use local version mysql-test/r/order_by.result: Use local version mysql-test/r/user_var.result: merge with 3.23 mysql-test/t/order_by.test: Use local version (test is already in range.test) sql/log.cc: Use local version sql/share/spanish/errmsg.txt: merge sql/slave.cc: Use local version sql/sql_class.h: Use local version sql/sql_select.cc: Use patch in 4.0 for range with NULL problem
25 lines
1 KiB
Text
25 lines
1 KiB
Text
error 1054;
|
|
set @a := foo;
|
|
set @a := connection_id() + 3;
|
|
select @a - connection_id();
|
|
|
|
# Check using and setting variables with SELECT DISTINCT
|
|
|
|
drop table if exists t1,t2;
|
|
CREATE TABLE t1 ( i int not null, v int not null,index (i));
|
|
insert into t1 values (1,1),(1,3),(2,1);
|
|
create table t2 (i int not null, unique (i));
|
|
insert into t2 select distinct i from t1;
|
|
select * from t2;
|
|
select distinct t2.i,@vv1:=if(sv1.i,1,0),@vv2:=if(sv2.i,1,0),@vv3:=if(sv3.i,1,0), @vv1+@vv2+@vv3 from t2 left join t1 as sv1 on sv1.i=t2.i and sv1.v=1 left join t1 as sv2 on sv2.i=t2.i and sv2.v=2 left join t1 as sv3 on sv3.i=t2.i and sv3.v=3;
|
|
explain select * from t1 where i=@vv1;
|
|
explain select * from t1 where @vv1:=@vv1+1 and i=@vv1;
|
|
explain select @vv1:=i from t1 where i=@vv1;
|
|
explain select * from t1 where i=@vv1;
|
|
drop table t1,t2;
|
|
|
|
# Check types of variables
|
|
select @a:=10, @b:=1, @a > @b, @a < @b;
|
|
select @a:="10", @b:="1", @a > @b, @a < @b;
|
|
select @a:=10, @b:=2, @a > @b, @a < @b;
|
|
select @a:="10", @b:="2", @a > @b, @a < @b;
|