1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-6996: SET STATEMENT default_week_format = .. has no effect

Change constant with a system variable.
This commit is contained in:
Oleksandr Byelkin
2014-12-02 09:04:09 +01:00
parent d6e8816435
commit 53ff66fe31
7 changed files with 56 additions and 8 deletions

View File

@ -1078,3 +1078,30 @@ set statement wait_timeout=default for select 1;
ERROR 42000: The system variable wait_timeout cannot be set in SET STATEMENT.
set statement interactive_timeout=default for select 1;
ERROR 42000: The system variable interactive_timeout cannot be set in SET STATEMENT.
set @save_week_format=@@default_week_format;
set @@default_week_format=0;
SET STATEMENT default_week_format = 2 FOR SELECT WEEK('2000-01-01');
WEEK('2000-01-01')
52
create table t1 (a date);
insert t1 values ('2000-01-01');
explain extended select week(a) from t1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00
Warnings:
Note 1003 select week('2000-01-01',@@default_week_format) AS `week(a)` from dual
prepare stmt1 from "select week(a) from t1";
execute stmt1;
week(a)
0
set default_week_format = 2;
execute stmt1;
week(a)
52
alter table t1 engine=myisam;
execute stmt1;
week(a)
52
deallocate prepare stmt1;
drop table t1;
set @@default_week_format=@save_week_format;