blob: 19dc4ff07698d3bfe2680a2e413c8ac9ecee2442 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#
# Test of ansi mode
#
--disable_warnings
drop table if exists t1;
--enable_warnings
--disable_service_connection
set sql_mode="MySQL40";
select @@sql_mode;
set @@sql_mode="ANSI";
select @@sql_mode;
# Test some functions that works different in ansi mode
SELECT 'A' || 'B';
# Test GROUP BY behaviour
CREATE TABLE t1 (id INT, id2 int);
SELECT id,NULL,1,1.1,'a' FROM t1 GROUP BY id;
#No --error 1055 error due to temporary fix for BUG#8510:
#ONLY_FULL_GROUP_BY is overly restrictive, so remove it from ANSI mode.
SELECT id FROM t1 GROUP BY id2;
drop table t1;
SET @@SQL_MODE="";
# Bug#14515
CREATE TABLE t1 (i int auto_increment NOT NULL, PRIMARY KEY (i));
SHOW CREATE TABLE t1;
SET @@SQL_MODE="MYSQL323";
SHOW CREATE TABLE t1;
SET @@SQL_MODE="MYSQL40";
SHOW CREATE TABLE t1;
SET @@SQL_MODE="NO_FIELD_OPTIONS";
SHOW CREATE TABLE t1;
DROP TABLE t1;
# End of 4.1 tests
--echo #
--echo # MDEV-16186 Concatenation operator || returns wrong results in sql_mode=ORACLE
--echo #
SET sql_mode=ANSI;
# Concatenation operator || is stronger than numeric dyadic operators ^ * + <<
SELECT -1<<1||1 AS a FROM DUAL;
SELECT -1||0<<1 AS a FROM DUAL;
EXPLAIN EXTENDED SELECT -1<<1||1 AS a FROM DUAL;
EXPLAIN EXTENDED SELECT -1||0<<1 AS a FROM DUAL;
SELECT -1+1||1 AS a FROM DUAL;
SELECT -1||0+1 AS a FROM DUAL;
EXPLAIN EXTENDED SELECT -1+1||1 AS a FROM DUAL;
EXPLAIN EXTENDED SELECT -1||0+1 AS a FROM DUAL;
SELECT 1*1||-1 AS a FROM DUAL;
SELECT 1||1*-1 AS a FROM DUAL;
EXPLAIN EXTENDED SELECT 1*1||-1 AS a FROM DUAL;
EXPLAIN EXTENDED SELECT 1||1*-1 AS a FROM DUAL;
SELECT -1^1||1 AS a FROM DUAL;
SELECT -1||0^1 AS a FROM DUAL;
EXPLAIN EXTENDED SELECT -1^1||1 AS a FROM DUAL;
EXPLAIN EXTENDED SELECT -1||0^1 AS a FROM DUAL;
--enable_service_connection
|