mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
precedence bugfixing
fix printing precedence for BETWEEN, LIKE/ESCAPE, REGEXP, IN don't use precedence for printing CASE/WHEN/THEN/ELSE/END fix parsing precedence of BETWEEN, LIKE/ESCAPE, REGEXP, IN support predicate arguments for IN, BETWEEN, SOUNDS LIKE, LIKE/ESCAPE, REGEXP use %nonassoc for unary operators fix parsing of IS TRUE/FALSE/UNKNOWN/NULL remove parser_precedence test as superseded by the precedence test
This commit is contained in:
@ -10052,11 +10052,11 @@ EXPLAIN
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (tab2.max_a = 1 or tab2.max_a = 2) then 1 else 0 end = 1",
|
||||
"attached_condition": "case when tab2.max_a = 1 or tab2.max_a = 2 then 1 else 0 end = 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"having_condition": "case when (max_a = 1 or max_a = 2) then 1 else 0 end = 1",
|
||||
"having_condition": "case when max_a = 1 or max_a = 2 then 1 else 0 end = 1",
|
||||
"filesort": {
|
||||
"sort_key": "t1.b",
|
||||
"temporary_table": {
|
||||
@ -10101,11 +10101,11 @@ EXPLAIN
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4) then 1 else 0 end = 1",
|
||||
"attached_condition": "case when tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4 then 1 else 0 end = 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"having_condition": "case when (max_a = 1 or max_a > 2 and max_a < 4) then 1 else 0 end = 1",
|
||||
"having_condition": "case when max_a = 1 or max_a > 2 and max_a < 4 then 1 else 0 end = 1",
|
||||
"filesort": {
|
||||
"sort_key": "t1.b",
|
||||
"temporary_table": {
|
||||
@ -10150,11 +10150,11 @@ EXPLAIN
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2)) then 1 else 0 end = 1",
|
||||
"attached_condition": "case when tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2) then 1 else 0 end = 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
"having_condition": "case when (max_a > 1 and (max_a = 2 or max_a > 2)) then 1 else 0 end = 1",
|
||||
"having_condition": "case when max_a > 1 and (max_a = 2 or max_a > 2) then 1 else 0 end = 1",
|
||||
"filesort": {
|
||||
"sort_key": "t1.b",
|
||||
"temporary_table": {
|
||||
@ -10199,7 +10199,7 @@ EXPLAIN
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (tab2.b = 2 or tab2.b = 4) then 1 else 0 end = 1",
|
||||
"attached_condition": "case when tab2.b = 2 or tab2.b = 4 then 1 else 0 end = 1",
|
||||
"materialized": {
|
||||
"query_block": {
|
||||
"select_id": 3,
|
||||
@ -10211,7 +10211,7 @@ EXPLAIN
|
||||
"access_type": "ALL",
|
||||
"rows": 3,
|
||||
"filtered": 100,
|
||||
"attached_condition": "case when (t1.b = 2 or t1.b = 4) then 1 else 0 end = 1"
|
||||
"attached_condition": "case when t1.b = 2 or t1.b = 4 then 1 else 0 end = 1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,15 +89,6 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
Warnings:
|
||||
Note 1003 select -1 AS `- a` from dual
|
||||
drop table t1;
|
||||
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
||||
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
|
||||
0 1
|
||||
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
|
||||
1 and 2 between 2 and 10 2 between 2 and 10 and 1
|
||||
1 1
|
||||
select 1 and 0 or 2, 2 or 1 and 0;
|
||||
1 and 0 or 2 2 or 1 and 0
|
||||
1 1
|
||||
select _koi8r'a' = _koi8r'A';
|
||||
_koi8r'a' = _koi8r'A'
|
||||
1
|
||||
|
@ -1321,3 +1321,20 @@ t1 CREATE TABLE `t1` (
|
||||
UNIQUE KEY `id` (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create or replace view v1 as select 1 between (2 between 3 and 4) and 5;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
view_definition
|
||||
select 1 between 2 between 3 and 4 and 5 AS `1 between (2 between 3 and 4) and 5`
|
||||
create or replace view v1 as select 1 between (2 in (3,4)) and 5;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
view_definition
|
||||
select 1 between 2 in (3,4) and 5 AS `1 between (2 in (3,4)) and 5`
|
||||
create or replace view v1 as select 1 between (2 like 3) and 4;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
view_definition
|
||||
select 1 between 2 like 3 and 4 AS `1 between (2 like 3) and 4`
|
||||
create or replace view v1 as select 1 not between (2 like 3) and 4;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
view_definition
|
||||
select 1 not between 2 like 3 and 4 AS `1 not between (2 like 3) and 4`
|
||||
drop view v1;
|
||||
|
@ -1,748 +0,0 @@
|
||||
drop table if exists t1_30237_bool;
|
||||
set sql_mode=NO_UNSIGNED_SUBTRACTION;
|
||||
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
||||
insert into t1_30237_bool values
|
||||
(FALSE, FALSE, FALSE),
|
||||
(FALSE, FALSE, NULL),
|
||||
(FALSE, FALSE, TRUE),
|
||||
(FALSE, NULL, FALSE),
|
||||
(FALSE, NULL, NULL),
|
||||
(FALSE, NULL, TRUE),
|
||||
(FALSE, TRUE, FALSE),
|
||||
(FALSE, TRUE, NULL),
|
||||
(FALSE, TRUE, TRUE),
|
||||
(NULL, FALSE, FALSE),
|
||||
(NULL, FALSE, NULL),
|
||||
(NULL, FALSE, TRUE),
|
||||
(NULL, NULL, FALSE),
|
||||
(NULL, NULL, NULL),
|
||||
(NULL, NULL, TRUE),
|
||||
(NULL, TRUE, FALSE),
|
||||
(NULL, TRUE, NULL),
|
||||
(NULL, TRUE, TRUE),
|
||||
(TRUE, FALSE, FALSE),
|
||||
(TRUE, FALSE, NULL),
|
||||
(TRUE, FALSE, TRUE),
|
||||
(TRUE, NULL, FALSE),
|
||||
(TRUE, NULL, NULL),
|
||||
(TRUE, NULL, TRUE),
|
||||
(TRUE, TRUE, FALSE),
|
||||
(TRUE, TRUE, NULL),
|
||||
(TRUE, TRUE, TRUE) ;
|
||||
Testing OR, XOR, AND
|
||||
select A, B, A OR B, A XOR B, A AND B
|
||||
from t1_30237_bool where C is null order by A, B;
|
||||
A B A OR B A XOR B A AND B
|
||||
NULL NULL NULL NULL NULL
|
||||
NULL 0 NULL NULL 0
|
||||
NULL 1 1 NULL NULL
|
||||
0 NULL NULL NULL 0
|
||||
0 0 0 0 0
|
||||
0 1 1 1 0
|
||||
1 NULL 1 NULL NULL
|
||||
1 0 1 1 0
|
||||
1 1 1 0 1
|
||||
Testing that OR is associative
|
||||
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) OR C A OR (B OR C) A OR B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 1 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 1 1 1
|
||||
NULL 1 NULL 1 1 1
|
||||
NULL 1 0 1 1 1
|
||||
NULL 1 1 1 1 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 1 1 1
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL 1 1 1
|
||||
0 1 0 1 1 1
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL 1 1 1
|
||||
1 NULL 0 1 1 1
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL 1 1 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 1 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A OR B) OR C) != (A OR (B OR C));
|
||||
count(*)
|
||||
0
|
||||
Testing that XOR is associative
|
||||
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) XOR C A XOR (B XOR C) A XOR B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 1 1 1
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 1 1 1
|
||||
1 0 1 0 0 0
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) XOR C) != (A XOR (B XOR C));
|
||||
count(*)
|
||||
0
|
||||
Testing that AND is associative
|
||||
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) AND C A AND (B AND C) A AND B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 0 0
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL 0 0 0
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 0 0 0
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 0 0
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL 0 0 0
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 0 0 0
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL 0 0 0
|
||||
0 1 0 0 0 0
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 0 0 0
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL 0 0 0
|
||||
1 0 0 0 0 0
|
||||
1 0 1 0 0 0
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) AND C) != (A AND (B AND C));
|
||||
count(*)
|
||||
0
|
||||
Testing that AND has precedence over OR
|
||||
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) AND C A OR (B AND C) A OR B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 NULL NULL
|
||||
NULL 1 1 1 1 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL 1 1
|
||||
1 NULL 0 0 1 1
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 0 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL NULL 1 1
|
||||
1 1 0 0 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B AND C)) != (A OR B AND C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) OR C A AND (B OR C) A AND B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 NULL 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 1 NULL 1
|
||||
0 NULL NULL NULL 0 NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 1 0 1
|
||||
0 0 NULL NULL 0 NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 0 1
|
||||
0 1 NULL NULL 0 NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 0 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 1 1 1
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 0 0 0
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 1 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 1 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) OR C) != (A AND B OR C);
|
||||
count(*)
|
||||
0
|
||||
Testing that AND has precedence over XOR
|
||||
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) AND C A XOR (B AND C) A XOR B AND C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 NULL NULL
|
||||
NULL 0 1 NULL NULL NULL
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 0 NULL NULL
|
||||
NULL 1 1 NULL NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL 0 0 0
|
||||
0 0 0 0 0 0
|
||||
0 0 1 0 0 0
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 0 1 1
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 0 1 1
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL 0 NULL NULL
|
||||
1 1 0 0 1 1
|
||||
1 1 1 0 0 0
|
||||
select count(*) from t1_30237_bool
|
||||
where (A XOR (B AND C)) != (A XOR B AND C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A AND B) XOR C A AND (B XOR C) A AND B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 0 0 0
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 NULL 0 NULL
|
||||
0 NULL NULL NULL 0 NULL
|
||||
0 NULL 0 0 0 0
|
||||
0 NULL 1 1 0 1
|
||||
0 0 NULL NULL 0 NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 0 1
|
||||
0 1 NULL NULL 0 NULL
|
||||
0 1 0 0 0 0
|
||||
0 1 1 1 0 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 NULL NULL NULL
|
||||
1 0 NULL NULL NULL NULL
|
||||
1 0 0 0 0 0
|
||||
1 0 1 1 1 1
|
||||
1 1 NULL NULL NULL NULL
|
||||
1 1 0 1 1 1
|
||||
1 1 1 0 0 0
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) XOR C) != (A AND B XOR C);
|
||||
count(*)
|
||||
0
|
||||
Testing that XOR has precedence over OR
|
||||
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A XOR B) OR C A XOR (B OR C) A XOR B OR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 1 NULL 1
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 1 NULL 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 NULL NULL NULL
|
||||
NULL 1 1 1 NULL 1
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 1 1 1
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL 1 1 1
|
||||
0 1 0 1 1 1
|
||||
0 1 1 1 1 1
|
||||
1 NULL NULL NULL NULL NULL
|
||||
1 NULL 0 NULL NULL NULL
|
||||
1 NULL 1 1 0 1
|
||||
1 0 NULL 1 NULL 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 1 0 1
|
||||
1 1 NULL NULL 0 NULL
|
||||
1 1 0 0 0 0
|
||||
1 1 1 1 0 1
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) OR C) != (A XOR B OR C);
|
||||
count(*)
|
||||
0
|
||||
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
A B C (A OR B) XOR C A OR (B XOR C) A OR B XOR C
|
||||
NULL NULL NULL NULL NULL NULL
|
||||
NULL NULL 0 NULL NULL NULL
|
||||
NULL NULL 1 NULL NULL NULL
|
||||
NULL 0 NULL NULL NULL NULL
|
||||
NULL 0 0 NULL NULL NULL
|
||||
NULL 0 1 NULL 1 1
|
||||
NULL 1 NULL NULL NULL NULL
|
||||
NULL 1 0 1 1 1
|
||||
NULL 1 1 0 NULL NULL
|
||||
0 NULL NULL NULL NULL NULL
|
||||
0 NULL 0 NULL NULL NULL
|
||||
0 NULL 1 NULL NULL NULL
|
||||
0 0 NULL NULL NULL NULL
|
||||
0 0 0 0 0 0
|
||||
0 0 1 1 1 1
|
||||
0 1 NULL NULL NULL NULL
|
||||
0 1 0 1 1 1
|
||||
0 1 1 0 0 0
|
||||
1 NULL NULL NULL 1 1
|
||||
1 NULL 0 1 1 1
|
||||
1 NULL 1 0 1 1
|
||||
1 0 NULL NULL 1 1
|
||||
1 0 0 1 1 1
|
||||
1 0 1 0 1 1
|
||||
1 1 NULL NULL 1 1
|
||||
1 1 0 1 1 1
|
||||
1 1 1 0 1 1
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B XOR C)) != (A OR B XOR C);
|
||||
count(*)
|
||||
0
|
||||
drop table t1_30237_bool;
|
||||
Testing that NOT has precedence over OR
|
||||
select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
|
||||
(NOT FALSE) OR TRUE NOT (FALSE OR TRUE) NOT FALSE OR TRUE
|
||||
1 0 1
|
||||
Testing that NOT has precedence over XOR
|
||||
select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
|
||||
(NOT FALSE) XOR FALSE NOT (FALSE XOR FALSE) NOT FALSE XOR FALSE
|
||||
1 1 1
|
||||
Testing that NOT has precedence over AND
|
||||
select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
|
||||
(NOT FALSE) AND FALSE NOT (FALSE AND FALSE) NOT FALSE AND FALSE
|
||||
0 1 0
|
||||
Testing that NOT is associative
|
||||
select NOT NOT TRUE, NOT NOT NOT FALSE;
|
||||
NOT NOT TRUE NOT NOT NOT FALSE
|
||||
1 1
|
||||
Testing that IS has precedence over NOT
|
||||
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
|
||||
(NOT NULL) IS TRUE NOT (NULL IS TRUE) NOT NULL IS TRUE
|
||||
0 1 1
|
||||
select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
|
||||
(NOT NULL) IS NOT TRUE NOT (NULL IS NOT TRUE) NOT NULL IS NOT TRUE
|
||||
1 0 0
|
||||
select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
|
||||
(NOT NULL) IS FALSE NOT (NULL IS FALSE) NOT NULL IS FALSE
|
||||
0 1 1
|
||||
select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
|
||||
(NOT NULL) IS NOT FALSE NOT (NULL IS NOT FALSE) NOT NULL IS NOT FALSE
|
||||
1 0 0
|
||||
select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
|
||||
(NOT TRUE) IS UNKNOWN NOT (TRUE IS UNKNOWN) NOT TRUE IS UNKNOWN
|
||||
0 1 1
|
||||
select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
|
||||
(NOT TRUE) IS NOT UNKNOWN NOT (TRUE IS NOT UNKNOWN) NOT TRUE IS NOT UNKNOWN
|
||||
1 0 0
|
||||
select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
|
||||
(NOT TRUE) IS NULL NOT (TRUE IS NULL) NOT TRUE IS NULL
|
||||
0 1 1
|
||||
select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
|
||||
(NOT TRUE) IS NOT NULL NOT (TRUE IS NOT NULL) NOT TRUE IS NOT NULL
|
||||
1 0 0
|
||||
Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
|
||||
select TRUE IS TRUE IS TRUE IS TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS TRUE IS TRUE' at line 1
|
||||
select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS NOT TRUE IS NOT TRUE' at line 1
|
||||
select NULL IS FALSE IS FALSE IS FALSE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS FALSE IS FALSE' at line 1
|
||||
select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS NOT FALSE IS NOT FALSE' at line 1
|
||||
select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS UNKNOWN IS UNKNOWN' at line 1
|
||||
select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IS NOT UNKNOWN IS NOT UNKNOWN' at line 1
|
||||
Testing that IS [NOT] NULL predicates are associative
|
||||
select FALSE IS NULL IS NULL IS NULL;
|
||||
FALSE IS NULL IS NULL IS NULL
|
||||
0
|
||||
select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
|
||||
TRUE IS NOT NULL IS NOT NULL IS NOT NULL
|
||||
1
|
||||
Testing that comparison operators are left associative
|
||||
select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
|
||||
1 <=> 2 <=> 2 (1 <=> 2) <=> 2 1 <=> (2 <=> 2)
|
||||
0 0 1
|
||||
select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
|
||||
1 = 2 = 2 (1 = 2) = 2 1 = (2 = 2)
|
||||
0 0 1
|
||||
select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
|
||||
1 != 2 != 3 (1 != 2) != 3 1 != (2 != 3)
|
||||
1 1 0
|
||||
select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
|
||||
1 <> 2 <> 3 (1 <> 2) <> 3 1 <> (2 <> 3)
|
||||
1 1 0
|
||||
select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
|
||||
1 < 2 < 3 (1 < 2) < 3 1 < (2 < 3)
|
||||
1 1 0
|
||||
select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
|
||||
3 <= 2 <= 1 (3 <= 2) <= 1 3 <= (2 <= 1)
|
||||
1 1 0
|
||||
select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
|
||||
1 > 2 > 3 (1 > 2) > 3 1 > (2 > 3)
|
||||
0 0 1
|
||||
select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
|
||||
1 >= 2 >= 3 (1 >= 2) >= 3 1 >= (2 >= 3)
|
||||
0 0 1
|
||||
Testing that | is associative
|
||||
select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
|
||||
0xF0 | 0x0F | 0x55 (0xF0 | 0x0F) | 0x55 0xF0 | (0x0F | 0x55)
|
||||
255 255 255
|
||||
Testing that & is associative
|
||||
select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
|
||||
0xF5 & 0x5F & 0x55 (0xF5 & 0x5F) & 0x55 0xF5 & (0x5F & 0x55)
|
||||
85 85 85
|
||||
Testing that << is left associative
|
||||
select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
|
||||
4 << 3 << 2 (4 << 3) << 2 4 << (3 << 2)
|
||||
128 128 16384
|
||||
Testing that >> is left associative
|
||||
select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
|
||||
256 >> 3 >> 2 (256 >> 3) >> 2 256 >> (3 >> 2)
|
||||
8 8 256
|
||||
Testing that & has precedence over |
|
||||
select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
|
||||
0xF0 & 0x0F | 0x55 (0xF0 & 0x0F) | 0x55 0xF0 & (0x0F | 0x55)
|
||||
85 85 80
|
||||
select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
|
||||
0x55 | 0xF0 & 0x0F (0x55 | 0xF0) & 0x0F 0x55 | (0xF0 & 0x0F)
|
||||
85 5 85
|
||||
Testing that << has precedence over |
|
||||
select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
|
||||
0x0F << 4 | 0x0F (0x0F << 4) | 0x0F 0x0F << (4 | 0x0F)
|
||||
255 255 491520
|
||||
select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
|
||||
0x0F | 0x0F << 4 (0x0F | 0x0F) << 4 0x0F | (0x0F << 4)
|
||||
255 240 255
|
||||
Testing that >> has precedence over |
|
||||
select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
|
||||
0xF0 >> 4 | 0xFF (0xF0 >> 4) | 0xFF 0xF0 >> (4 | 0xFF)
|
||||
255 255 0
|
||||
select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
|
||||
0xFF | 0xF0 >> 4 (0xFF | 0xF0) >> 4 0xFF | (0xF0 >> 4)
|
||||
255 15 255
|
||||
Testing that << has precedence over &
|
||||
select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
|
||||
0x0F << 4 & 0xF0 (0x0F << 4) & 0xF0 0x0F << (4 & 0xF0)
|
||||
240 240 15
|
||||
select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
|
||||
0xF0 & 0x0F << 4 (0xF0 & 0x0F) << 4 0xF0 & (0x0F << 4)
|
||||
240 0 240
|
||||
Testing that >> has precedence over &
|
||||
select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
|
||||
0xF0 >> 4 & 0x55 (0xF0 >> 4) & 0x55 0xF0 >> (4 & 0x55)
|
||||
5 5 15
|
||||
select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
|
||||
0x0F & 0xF0 >> 4 (0x0F & 0xF0) >> 4 0x0F & (0xF0 >> 4)
|
||||
15 0 15
|
||||
Testing that >> and << have the same precedence
|
||||
select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
|
||||
0xFF >> 4 << 2 (0xFF >> 4) << 2 0xFF >> (4 << 2)
|
||||
60 60 0
|
||||
select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
|
||||
0x0F << 4 >> 2 (0x0F << 4) >> 2 0x0F << (4 >> 2)
|
||||
60 60 30
|
||||
Testing that binary + is associative
|
||||
select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
|
||||
1 + 2 + 3 (1 + 2) + 3 1 + (2 + 3)
|
||||
6 6 6
|
||||
Testing that binary - is left associative
|
||||
select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
|
||||
1 - 2 - 3 (1 - 2) - 3 1 - (2 - 3)
|
||||
-4 -4 2
|
||||
Testing that binary + and binary - have the same precedence
|
||||
select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
|
||||
1 + 2 - 3 (1 + 2) - 3 1 + (2 - 3)
|
||||
0 0 0
|
||||
select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
|
||||
1 - 2 + 3 (1 - 2) + 3 1 - (2 + 3)
|
||||
2 2 -4
|
||||
Testing that binary + has precedence over |
|
||||
select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
|
||||
0xF0 + 0x0F | 0x55 (0xF0 + 0x0F) | 0x55 0xF0 + (0x0F | 0x55)
|
||||
255 255 335
|
||||
select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
|
||||
0x55 | 0xF0 + 0x0F (0x55 | 0xF0) + 0x0F 0x55 | (0xF0 + 0x0F)
|
||||
255 260 255
|
||||
Testing that binary + has precedence over &
|
||||
select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
|
||||
0xF0 + 0x0F & 0x55 (0xF0 + 0x0F) & 0x55 0xF0 + (0x0F & 0x55)
|
||||
85 85 245
|
||||
select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
|
||||
0x55 & 0xF0 + 0x0F (0x55 & 0xF0) + 0x0F 0x55 & (0xF0 + 0x0F)
|
||||
85 95 85
|
||||
Testing that binary + has precedence over <<
|
||||
select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
|
||||
2 + 3 << 4 (2 + 3) << 4 2 + (3 << 4)
|
||||
80 80 50
|
||||
select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
|
||||
3 << 4 + 2 (3 << 4) + 2 3 << (4 + 2)
|
||||
192 50 192
|
||||
Testing that binary + has precedence over >>
|
||||
select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
|
||||
4 + 3 >> 2 (4 + 3) >> 2 4 + (3 >> 2)
|
||||
1 1 4
|
||||
select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
|
||||
3 >> 2 + 1 (3 >> 2) + 1 3 >> (2 + 1)
|
||||
0 1 0
|
||||
Testing that binary - has precedence over |
|
||||
select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
|
||||
0xFF - 0x0F | 0x55 (0xFF - 0x0F) | 0x55 0xFF - (0x0F | 0x55)
|
||||
245 245 160
|
||||
select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
|
||||
0x55 | 0xFF - 0xF0 (0x55 | 0xFF) - 0xF0 0x55 | (0xFF - 0xF0)
|
||||
95 15 95
|
||||
Testing that binary - has precedence over &
|
||||
select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
|
||||
0xFF - 0xF0 & 0x55 (0xFF - 0xF0) & 0x55 0xFF - (0xF0 & 0x55)
|
||||
5 5 175
|
||||
select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
|
||||
0x55 & 0xFF - 0xF0 (0x55 & 0xFF) - 0xF0 0x55 & (0xFF - 0xF0)
|
||||
5 -155 5
|
||||
Testing that binary - has precedence over <<
|
||||
select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
|
||||
16 - 3 << 2 (16 - 3) << 2 16 - (3 << 2)
|
||||
52 52 4
|
||||
select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
|
||||
4 << 3 - 2 (4 << 3) - 2 4 << (3 - 2)
|
||||
8 30 8
|
||||
Testing that binary - has precedence over >>
|
||||
select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
|
||||
16 - 3 >> 2 (16 - 3) >> 2 16 - (3 >> 2)
|
||||
3 3 16
|
||||
select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
|
||||
16 >> 3 - 2 (16 >> 3) - 2 16 >> (3 - 2)
|
||||
8 0 8
|
||||
Testing that * is associative
|
||||
select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
|
||||
2 * 3 * 4 (2 * 3) * 4 2 * (3 * 4)
|
||||
24 24 24
|
||||
Testing that * has precedence over |
|
||||
select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
|
||||
2 * 0x40 | 0x0F (2 * 0x40) | 0x0F 2 * (0x40 | 0x0F)
|
||||
143 143 158
|
||||
select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
|
||||
0x0F | 2 * 0x40 (0x0F | 2) * 0x40 0x0F | (2 * 0x40)
|
||||
143 960 143
|
||||
Testing that * has precedence over &
|
||||
select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
|
||||
2 * 0x40 & 0x55 (2 * 0x40) & 0x55 2 * (0x40 & 0x55)
|
||||
0 0 128
|
||||
select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
|
||||
0xF0 & 2 * 0x40 (0xF0 & 2) * 0x40 0xF0 & (2 * 0x40)
|
||||
128 0 128
|
||||
Testing that * has precedence over <<
|
||||
select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
|
||||
5 * 3 << 4 (5 * 3) << 4 5 * (3 << 4)
|
||||
240 240 240
|
||||
select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
|
||||
2 << 3 * 4 (2 << 3) * 4 2 << (3 * 4)
|
||||
8192 64 8192
|
||||
Testing that * has precedence over >>
|
||||
select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
|
||||
3 * 4 >> 2 (3 * 4) >> 2 3 * (4 >> 2)
|
||||
3 3 3
|
||||
select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
|
||||
4 >> 2 * 3 (4 >> 2) * 3 4 >> (2 * 3)
|
||||
0 3 0
|
||||
Testing that * has precedence over binary +
|
||||
select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
|
||||
2 * 3 + 4 (2 * 3) + 4 2 * (3 + 4)
|
||||
10 10 14
|
||||
select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
|
||||
2 + 3 * 4 (2 + 3) * 4 2 + (3 * 4)
|
||||
14 20 14
|
||||
Testing that * has precedence over binary -
|
||||
select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
|
||||
4 * 3 - 2 (4 * 3) - 2 4 * (3 - 2)
|
||||
10 10 4
|
||||
select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
|
||||
4 - 3 * 2 (4 - 3) * 2 4 - (3 * 2)
|
||||
-2 2 -2
|
||||
Testing that / is left associative
|
||||
select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
|
||||
15 / 5 / 3 (15 / 5) / 3 15 / (5 / 3)
|
||||
1.00000000 1.00000000 8.9998
|
||||
Testing that / has precedence over |
|
||||
select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
|
||||
105 / 5 | 2 (105 / 5) | 2 105 / (5 | 2)
|
||||
23 23 15.0000
|
||||
select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
|
||||
105 | 2 / 5 (105 | 2) / 5 105 | (2 / 5)
|
||||
105 21.4000 105
|
||||
Testing that / has precedence over &
|
||||
select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
|
||||
105 / 5 & 0x0F (105 / 5) & 0x0F 105 / (5 & 0x0F)
|
||||
5 5 21.0000
|
||||
select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
|
||||
0x0F & 105 / 5 (0x0F & 105) / 5 0x0F & (105 / 5)
|
||||
5 1.8000 5
|
||||
Testing that / has precedence over <<
|
||||
select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
|
||||
0x80 / 4 << 2 (0x80 / 4) << 2 0x80 / (4 << 2)
|
||||
128 128 8.0000
|
||||
select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
|
||||
0x80 << 4 / 2 (0x80 << 4) / 2 0x80 << (4 / 2)
|
||||
512 1024.0000 512
|
||||
Testing that / has precedence over >>
|
||||
select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
|
||||
0x80 / 4 >> 2 (0x80 / 4) >> 2 0x80 / (4 >> 2)
|
||||
8 8 128.0000
|
||||
select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
|
||||
0x80 >> 4 / 2 (0x80 >> 4) / 2 0x80 >> (4 / 2)
|
||||
32 4.0000 32
|
||||
Testing that / has precedence over binary +
|
||||
select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
|
||||
0x80 / 2 + 2 (0x80 / 2) + 2 0x80 / (2 + 2)
|
||||
66.0000 66.0000 32.0000
|
||||
select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
|
||||
0x80 + 2 / 2 (0x80 + 2) / 2 0x80 + (2 / 2)
|
||||
129.0000 65.0000 129.0000
|
||||
Testing that / has precedence over binary -
|
||||
select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
|
||||
0x80 / 4 - 2 (0x80 / 4) - 2 0x80 / (4 - 2)
|
||||
30.0000 30.0000 64.0000
|
||||
select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
|
||||
0x80 - 4 / 2 (0x80 - 4) / 2 0x80 - (4 / 2)
|
||||
126.0000 62.0000 126.0000
|
||||
Testing that ^ is associative
|
||||
select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
|
||||
0xFF ^ 0xF0 ^ 0x0F (0xFF ^ 0xF0) ^ 0x0F 0xFF ^ (0xF0 ^ 0x0F)
|
||||
0 0 0
|
||||
select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
|
||||
0xFF ^ 0xF0 ^ 0x55 (0xFF ^ 0xF0) ^ 0x55 0xFF ^ (0xF0 ^ 0x55)
|
||||
90 90 90
|
||||
Testing that ^ has precedence over |
|
||||
select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
|
||||
0xFF ^ 0xF0 | 0x0F (0xFF ^ 0xF0) | 0x0F 0xFF ^ (0xF0 | 0x0F)
|
||||
15 15 0
|
||||
select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
|
||||
0xF0 | 0xFF ^ 0xF0 (0xF0 | 0xFF) ^ 0xF0 0xF0 | (0xFF ^ 0xF0)
|
||||
255 15 255
|
||||
Testing that ^ has precedence over &
|
||||
select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
|
||||
0xFF ^ 0xF0 & 0x0F (0xFF ^ 0xF0) & 0x0F 0xFF ^ (0xF0 & 0x0F)
|
||||
15 15 255
|
||||
select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
|
||||
0x0F & 0xFF ^ 0xF0 (0x0F & 0xFF) ^ 0xF0 0x0F & (0xFF ^ 0xF0)
|
||||
15 255 15
|
||||
Testing that ^ has precedence over <<
|
||||
select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
|
||||
0xFF ^ 0xF0 << 2 (0xFF ^ 0xF0) << 2 0xFF ^ (0xF0 << 2)
|
||||
60 60 831
|
||||
select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
|
||||
0x0F << 2 ^ 0xFF (0x0F << 2) ^ 0xFF 0x0F << (2 ^ 0xFF)
|
||||
0 195 0
|
||||
Testing that ^ has precedence over >>
|
||||
select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
|
||||
0xFF ^ 0xF0 >> 2 (0xFF ^ 0xF0) >> 2 0xFF ^ (0xF0 >> 2)
|
||||
3 3 195
|
||||
select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
|
||||
0xFF >> 2 ^ 0xF0 (0xFF >> 2) ^ 0xF0 0xFF >> (2 ^ 0xF0)
|
||||
0 207 0
|
||||
Testing that ^ has precedence over binary +
|
||||
select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
|
||||
0xFF ^ 0xF0 + 0x0F (0xFF ^ 0xF0) + 0x0F 0xFF ^ (0xF0 + 0x0F)
|
||||
30 30 0
|
||||
select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
|
||||
0x0F + 0xFF ^ 0xF0 (0x0F + 0xFF) ^ 0xF0 0x0F + (0xFF ^ 0xF0)
|
||||
30 510 30
|
||||
Testing that ^ has precedence over binary -
|
||||
select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
|
||||
0xFF ^ 0xF0 - 1 (0xFF ^ 0xF0) - 1 0xFF ^ (0xF0 - 1)
|
||||
14 14 16
|
||||
select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
|
||||
0x55 - 0x0F ^ 0x55 (0x55 - 0x0F) ^ 0x55 0x55 - (0x0F ^ 0x55)
|
||||
-5 19 -5
|
||||
Testing that ^ has precedence over *
|
||||
select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
|
||||
0xFF ^ 0xF0 * 2 (0xFF ^ 0xF0) * 2 0xFF ^ (0xF0 * 2)
|
||||
30 30 287
|
||||
select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
|
||||
2 * 0xFF ^ 0xF0 (2 * 0xFF) ^ 0xF0 2 * (0xFF ^ 0xF0)
|
||||
30 270 30
|
||||
Testing that ^ has precedence over /
|
||||
select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
|
||||
0xFF ^ 0xF0 / 2 (0xFF ^ 0xF0) / 2 0xFF ^ (0xF0 / 2)
|
||||
7.5000 7.5000 135
|
||||
select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
|
||||
0xF2 / 2 ^ 0xF0 (0xF2 / 2) ^ 0xF0 0xF2 / (2 ^ 0xF0)
|
||||
1.0000 137 1.0000
|
||||
Testing that ^ has precedence over %
|
||||
select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
|
||||
0xFF ^ 0xF0 % 0x20 (0xFF ^ 0xF0) % 0x20 0xFF ^ (0xF0 % 0x20)
|
||||
15 15 239
|
||||
select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
|
||||
0xFF % 0x20 ^ 0xF0 (0xFF % 0x20) ^ 0xF0 0xFF % (0x20 ^ 0xF0)
|
||||
47 239 47
|
||||
Testing that ^ has precedence over DIV
|
||||
select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
|
||||
0xFF ^ 0xF0 DIV 2 (0xFF ^ 0xF0) DIV 2 0xFF ^ (0xF0 DIV 2)
|
||||
7 7 135
|
||||
select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
|
||||
0xF2 DIV 2 ^ 0xF0 (0xF2 DIV 2) ^ 0xF0 0xF2 DIV (2 ^ 0xF0)
|
||||
1 137 1
|
||||
Testing that ^ has precedence over MOD
|
||||
select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
|
||||
0xFF ^ 0xF0 MOD 0x20 (0xFF ^ 0xF0) MOD 0x20 0xFF ^ (0xF0 MOD 0x20)
|
||||
15 15 239
|
||||
select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
|
||||
0xFF MOD 0x20 ^ 0xF0 (0xFF MOD 0x20) ^ 0xF0 0xFF MOD (0x20 ^ 0xF0)
|
||||
47 239 47
|
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,7 @@ grad_degree CREATE TABLE `grad_degree` (
|
||||
`plan` varchar(10) NOT NULL,
|
||||
`admit_term` char(4) NOT NULL,
|
||||
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
|
||||
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
|
||||
PRIMARY KEY (`student_id`,`plan`,`admit_term`)
|
||||
@ -136,14 +136,14 @@ grad_degree CREATE TABLE `grad_degree` (
|
||||
`plan` varchar(10) NOT NULL,
|
||||
`admit_term` char(4) NOT NULL,
|
||||
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
|
||||
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
|
||||
PRIMARY KEY (`student_id`,`plan`,`admit_term`)
|
||||
@ -193,14 +193,14 @@ grad_degree CREATE TABLE `grad_degree` (
|
||||
`plan` varchar(10) NOT NULL,
|
||||
`admit_term` char(4) NOT NULL,
|
||||
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
|
||||
PRIMARY KEY (`student_id`,`plan`,`admit_term`),
|
||||
KEY `grad_degree_as_of_term_ndx` (`deg_as_of_term`)
|
||||
@ -270,14 +270,14 @@ grad_degree CREATE TABLE `grad_degree` (
|
||||
`plan` varchar(10) NOT NULL,
|
||||
`admit_term` char(4) NOT NULL,
|
||||
`wdraw_rsn` varchar(4) NOT NULL DEFAULT '',
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when (`wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC') then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`ofis_deg_status` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed' else 'Not Completed' end) VIRTUAL,
|
||||
`ofis_deg_status2` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress2' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed2' else 'Not Completed2' end) VIRTUAL,
|
||||
`ofis_deg_status3` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress3' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed3' else 'Not Completed3' end) VIRTUAL,
|
||||
`ofis_deg_status4` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress4' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed4' else 'Not Completed4' end) VIRTUAL,
|
||||
`ofis_deg_status5` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress5' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed5' else 'Not Completed5' end) VIRTUAL,
|
||||
`ofis_deg_status6` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress6' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed6' else 'Not Completed6' end) VIRTUAL,
|
||||
`ofis_deg_status7` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress7' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed7' else 'Not Completed7' end) VIRTUAL,
|
||||
`ofis_deg_status8` varchar(15) GENERATED ALWAYS AS (case when `wdraw_rsn` = '' then 'In progress8' when `wdraw_rsn` = 'DCMP' or `wdraw_rsn` = 'TRDC' then 'Completed8' else 'Not Completed8' end) VIRTUAL,
|
||||
`deg_start_term` char(4) NOT NULL DEFAULT '' COMMENT 'Educated guess at the beginning of the data',
|
||||
`deg_as_of_term` char(4) NOT NULL COMMENT 'In most cases also end term',
|
||||
PRIMARY KEY (`student_id`,`plan`,`admit_term`)
|
||||
|
@ -35,14 +35,6 @@ select - a from t1;
|
||||
explain extended select - a from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Wrong usage of functions
|
||||
#
|
||||
|
||||
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
||||
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
|
||||
select 1 and 0 or 2, 2 or 1 and 0;
|
||||
|
||||
#
|
||||
# Coercibility
|
||||
#
|
||||
|
@ -1351,3 +1351,17 @@ create function fs() returns serial return 1;
|
||||
create table t1 ( id serial );
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BETWEEN syntax
|
||||
#
|
||||
create or replace view v1 as select 1 between (2 between 3 and 4) and 5;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
create or replace view v1 as select 1 between (2 in (3,4)) and 5;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
create or replace view v1 as select 1 between (2 like 3) and 4;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
create or replace view v1 as select 1 not between (2 like 3) and 4;
|
||||
Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
|
||||
|
||||
drop view v1;
|
||||
|
@ -1,335 +0,0 @@
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1_30237_bool;
|
||||
--enable_warnings
|
||||
|
||||
set sql_mode=NO_UNSIGNED_SUBTRACTION;
|
||||
|
||||
create table t1_30237_bool(A boolean, B boolean, C boolean);
|
||||
|
||||
insert into t1_30237_bool values
|
||||
(FALSE, FALSE, FALSE),
|
||||
(FALSE, FALSE, NULL),
|
||||
(FALSE, FALSE, TRUE),
|
||||
(FALSE, NULL, FALSE),
|
||||
(FALSE, NULL, NULL),
|
||||
(FALSE, NULL, TRUE),
|
||||
(FALSE, TRUE, FALSE),
|
||||
(FALSE, TRUE, NULL),
|
||||
(FALSE, TRUE, TRUE),
|
||||
(NULL, FALSE, FALSE),
|
||||
(NULL, FALSE, NULL),
|
||||
(NULL, FALSE, TRUE),
|
||||
(NULL, NULL, FALSE),
|
||||
(NULL, NULL, NULL),
|
||||
(NULL, NULL, TRUE),
|
||||
(NULL, TRUE, FALSE),
|
||||
(NULL, TRUE, NULL),
|
||||
(NULL, TRUE, TRUE),
|
||||
(TRUE, FALSE, FALSE),
|
||||
(TRUE, FALSE, NULL),
|
||||
(TRUE, FALSE, TRUE),
|
||||
(TRUE, NULL, FALSE),
|
||||
(TRUE, NULL, NULL),
|
||||
(TRUE, NULL, TRUE),
|
||||
(TRUE, TRUE, FALSE),
|
||||
(TRUE, TRUE, NULL),
|
||||
(TRUE, TRUE, TRUE) ;
|
||||
|
||||
--echo Testing OR, XOR, AND
|
||||
select A, B, A OR B, A XOR B, A AND B
|
||||
from t1_30237_bool where C is null order by A, B;
|
||||
|
||||
--echo Testing that OR is associative
|
||||
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A OR B) OR C) != (A OR (B OR C));
|
||||
|
||||
--echo Testing that XOR is associative
|
||||
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) XOR C) != (A XOR (B XOR C));
|
||||
|
||||
--echo Testing that AND is associative
|
||||
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) AND C) != (A AND (B AND C));
|
||||
|
||||
--echo Testing that AND has precedence over OR
|
||||
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B AND C)) != (A OR B AND C);
|
||||
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) OR C) != (A AND B OR C);
|
||||
|
||||
--echo Testing that AND has precedence over XOR
|
||||
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where (A XOR (B AND C)) != (A XOR B AND C);
|
||||
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A AND B) XOR C) != (A AND B XOR C);
|
||||
|
||||
--echo Testing that XOR has precedence over OR
|
||||
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where ((A XOR B) OR C) != (A XOR B OR C);
|
||||
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
|
||||
from t1_30237_bool order by A, B, C;
|
||||
select count(*) from t1_30237_bool
|
||||
where (A OR (B XOR C)) != (A OR B XOR C);
|
||||
|
||||
drop table t1_30237_bool;
|
||||
|
||||
--echo Testing that NOT has precedence over OR
|
||||
select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
|
||||
|
||||
--echo Testing that NOT has precedence over XOR
|
||||
select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
|
||||
|
||||
--echo Testing that NOT has precedence over AND
|
||||
select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
|
||||
|
||||
--echo Testing that NOT is associative
|
||||
select NOT NOT TRUE, NOT NOT NOT FALSE;
|
||||
|
||||
--echo Testing that IS has precedence over NOT
|
||||
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
|
||||
select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
|
||||
select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
|
||||
select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
|
||||
select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
|
||||
select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
|
||||
select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
|
||||
select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
|
||||
|
||||
--echo Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
|
||||
# Documenting existing behavior in 5.0.48
|
||||
-- error ER_PARSE_ERROR
|
||||
select TRUE IS TRUE IS TRUE IS TRUE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select NULL IS FALSE IS FALSE IS FALSE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
|
||||
-- error ER_PARSE_ERROR
|
||||
select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
|
||||
-- error ER_PARSE_ERROR
|
||||
select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
|
||||
|
||||
--echo Testing that IS [NOT] NULL predicates are associative
|
||||
# Documenting existing behavior in 5.0.48
|
||||
select FALSE IS NULL IS NULL IS NULL;
|
||||
select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
|
||||
|
||||
--echo Testing that comparison operators are left associative
|
||||
select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
|
||||
select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
|
||||
select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
|
||||
select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
|
||||
select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
|
||||
select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
|
||||
select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
|
||||
select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
|
||||
|
||||
-- echo Testing that | is associative
|
||||
select 0xF0 | 0x0F | 0x55, (0xF0 | 0x0F) | 0x55, 0xF0 | (0x0F | 0x55);
|
||||
|
||||
-- echo Testing that & is associative
|
||||
select 0xF5 & 0x5F & 0x55, (0xF5 & 0x5F) & 0x55, 0xF5 & (0x5F & 0x55);
|
||||
|
||||
-- echo Testing that << is left associative
|
||||
select 4 << 3 << 2, (4 << 3) << 2, 4 << (3 << 2);
|
||||
|
||||
-- echo Testing that >> is left associative
|
||||
select 256 >> 3 >> 2, (256 >> 3) >> 2, 256 >> (3 >> 2);
|
||||
|
||||
--echo Testing that & has precedence over |
|
||||
select 0xF0 & 0x0F | 0x55, (0xF0 & 0x0F) | 0x55, 0xF0 & (0x0F | 0x55);
|
||||
select 0x55 | 0xF0 & 0x0F, (0x55 | 0xF0) & 0x0F, 0x55 | (0xF0 & 0x0F);
|
||||
|
||||
--echo Testing that << has precedence over |
|
||||
select 0x0F << 4 | 0x0F, (0x0F << 4) | 0x0F, 0x0F << (4 | 0x0F);
|
||||
select 0x0F | 0x0F << 4, (0x0F | 0x0F) << 4, 0x0F | (0x0F << 4);
|
||||
|
||||
--echo Testing that >> has precedence over |
|
||||
select 0xF0 >> 4 | 0xFF, (0xF0 >> 4) | 0xFF, 0xF0 >> (4 | 0xFF);
|
||||
select 0xFF | 0xF0 >> 4, (0xFF | 0xF0) >> 4, 0xFF | (0xF0 >> 4);
|
||||
|
||||
--echo Testing that << has precedence over &
|
||||
select 0x0F << 4 & 0xF0, (0x0F << 4) & 0xF0, 0x0F << (4 & 0xF0);
|
||||
select 0xF0 & 0x0F << 4, (0xF0 & 0x0F) << 4, 0xF0 & (0x0F << 4);
|
||||
|
||||
--echo Testing that >> has precedence over &
|
||||
select 0xF0 >> 4 & 0x55, (0xF0 >> 4) & 0x55, 0xF0 >> (4 & 0x55);
|
||||
select 0x0F & 0xF0 >> 4, (0x0F & 0xF0) >> 4, 0x0F & (0xF0 >> 4);
|
||||
|
||||
--echo Testing that >> and << have the same precedence
|
||||
select 0xFF >> 4 << 2, (0xFF >> 4) << 2, 0xFF >> (4 << 2);
|
||||
select 0x0F << 4 >> 2, (0x0F << 4) >> 2, 0x0F << (4 >> 2);
|
||||
|
||||
--echo Testing that binary + is associative
|
||||
select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
|
||||
|
||||
--echo Testing that binary - is left associative
|
||||
select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
|
||||
|
||||
--echo Testing that binary + and binary - have the same precedence
|
||||
# evaluated left to right
|
||||
select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
|
||||
select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
|
||||
|
||||
--echo Testing that binary + has precedence over |
|
||||
select 0xF0 + 0x0F | 0x55, (0xF0 + 0x0F) | 0x55, 0xF0 + (0x0F | 0x55);
|
||||
select 0x55 | 0xF0 + 0x0F, (0x55 | 0xF0) + 0x0F, 0x55 | (0xF0 + 0x0F);
|
||||
|
||||
--echo Testing that binary + has precedence over &
|
||||
select 0xF0 + 0x0F & 0x55, (0xF0 + 0x0F) & 0x55, 0xF0 + (0x0F & 0x55);
|
||||
select 0x55 & 0xF0 + 0x0F, (0x55 & 0xF0) + 0x0F, 0x55 & (0xF0 + 0x0F);
|
||||
|
||||
--echo Testing that binary + has precedence over <<
|
||||
select 2 + 3 << 4, (2 + 3) << 4, 2 + (3 << 4);
|
||||
select 3 << 4 + 2, (3 << 4) + 2, 3 << (4 + 2);
|
||||
|
||||
--echo Testing that binary + has precedence over >>
|
||||
select 4 + 3 >> 2, (4 + 3) >> 2, 4 + (3 >> 2);
|
||||
select 3 >> 2 + 1, (3 >> 2) + 1, 3 >> (2 + 1);
|
||||
|
||||
--echo Testing that binary - has precedence over |
|
||||
select 0xFF - 0x0F | 0x55, (0xFF - 0x0F) | 0x55, 0xFF - (0x0F | 0x55);
|
||||
select 0x55 | 0xFF - 0xF0, (0x55 | 0xFF) - 0xF0, 0x55 | (0xFF - 0xF0);
|
||||
|
||||
--echo Testing that binary - has precedence over &
|
||||
select 0xFF - 0xF0 & 0x55, (0xFF - 0xF0) & 0x55, 0xFF - (0xF0 & 0x55);
|
||||
select 0x55 & 0xFF - 0xF0, (0x55 & 0xFF) - 0xF0, 0x55 & (0xFF - 0xF0);
|
||||
|
||||
--echo Testing that binary - has precedence over <<
|
||||
select 16 - 3 << 2, (16 - 3) << 2, 16 - (3 << 2);
|
||||
select 4 << 3 - 2, (4 << 3) - 2, 4 << (3 - 2);
|
||||
|
||||
--echo Testing that binary - has precedence over >>
|
||||
select 16 - 3 >> 2, (16 - 3) >> 2, 16 - (3 >> 2);
|
||||
select 16 >> 3 - 2, (16 >> 3) - 2, 16 >> (3 - 2);
|
||||
|
||||
--echo Testing that * is associative
|
||||
select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
|
||||
|
||||
--echo Testing that * has precedence over |
|
||||
select 2 * 0x40 | 0x0F, (2 * 0x40) | 0x0F, 2 * (0x40 | 0x0F);
|
||||
select 0x0F | 2 * 0x40, (0x0F | 2) * 0x40, 0x0F | (2 * 0x40);
|
||||
|
||||
--echo Testing that * has precedence over &
|
||||
select 2 * 0x40 & 0x55, (2 * 0x40) & 0x55, 2 * (0x40 & 0x55);
|
||||
select 0xF0 & 2 * 0x40, (0xF0 & 2) * 0x40, 0xF0 & (2 * 0x40);
|
||||
|
||||
--echo Testing that * has precedence over <<
|
||||
# Actually, can't prove it for the first case,
|
||||
# since << is a multiplication by a power of 2,
|
||||
# and * is associative
|
||||
select 5 * 3 << 4, (5 * 3) << 4, 5 * (3 << 4);
|
||||
select 2 << 3 * 4, (2 << 3) * 4, 2 << (3 * 4);
|
||||
|
||||
--echo Testing that * has precedence over >>
|
||||
# >> is a multiplication by a (negative) power of 2,
|
||||
# see above.
|
||||
select 3 * 4 >> 2, (3 * 4) >> 2, 3 * (4 >> 2);
|
||||
select 4 >> 2 * 3, (4 >> 2) * 3, 4 >> (2 * 3);
|
||||
|
||||
--echo Testing that * has precedence over binary +
|
||||
select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
|
||||
select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
|
||||
|
||||
--echo Testing that * has precedence over binary -
|
||||
select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
|
||||
select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
|
||||
|
||||
--echo Testing that / is left associative
|
||||
select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
|
||||
|
||||
--echo Testing that / has precedence over |
|
||||
select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2);
|
||||
select 105 | 2 / 5, (105 | 2) / 5, 105 | (2 / 5);
|
||||
|
||||
--echo Testing that / has precedence over &
|
||||
select 105 / 5 & 0x0F, (105 / 5) & 0x0F, 105 / (5 & 0x0F);
|
||||
select 0x0F & 105 / 5, (0x0F & 105) / 5, 0x0F & (105 / 5);
|
||||
|
||||
--echo Testing that / has precedence over <<
|
||||
select 0x80 / 4 << 2, (0x80 / 4) << 2, 0x80 / (4 << 2);
|
||||
select 0x80 << 4 / 2, (0x80 << 4) / 2, 0x80 << (4 / 2);
|
||||
|
||||
--echo Testing that / has precedence over >>
|
||||
select 0x80 / 4 >> 2, (0x80 / 4) >> 2, 0x80 / (4 >> 2);
|
||||
select 0x80 >> 4 / 2, (0x80 >> 4) / 2, 0x80 >> (4 / 2);
|
||||
|
||||
--echo Testing that / has precedence over binary +
|
||||
select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
|
||||
select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
|
||||
|
||||
--echo Testing that / has precedence over binary -
|
||||
select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
|
||||
select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);
|
||||
|
||||
# TODO: %, DIV, MOD
|
||||
|
||||
--echo Testing that ^ is associative
|
||||
select 0xFF ^ 0xF0 ^ 0x0F, (0xFF ^ 0xF0) ^ 0x0F, 0xFF ^ (0xF0 ^ 0x0F);
|
||||
select 0xFF ^ 0xF0 ^ 0x55, (0xFF ^ 0xF0) ^ 0x55, 0xFF ^ (0xF0 ^ 0x55);
|
||||
|
||||
--echo Testing that ^ has precedence over |
|
||||
select 0xFF ^ 0xF0 | 0x0F, (0xFF ^ 0xF0) | 0x0F, 0xFF ^ (0xF0 | 0x0F);
|
||||
select 0xF0 | 0xFF ^ 0xF0, (0xF0 | 0xFF) ^ 0xF0, 0xF0 | (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over &
|
||||
select 0xFF ^ 0xF0 & 0x0F, (0xFF ^ 0xF0) & 0x0F, 0xFF ^ (0xF0 & 0x0F);
|
||||
select 0x0F & 0xFF ^ 0xF0, (0x0F & 0xFF) ^ 0xF0, 0x0F & (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over <<
|
||||
select 0xFF ^ 0xF0 << 2, (0xFF ^ 0xF0) << 2, 0xFF ^ (0xF0 << 2);
|
||||
select 0x0F << 2 ^ 0xFF, (0x0F << 2) ^ 0xFF, 0x0F << (2 ^ 0xFF);
|
||||
|
||||
--echo Testing that ^ has precedence over >>
|
||||
select 0xFF ^ 0xF0 >> 2, (0xFF ^ 0xF0) >> 2, 0xFF ^ (0xF0 >> 2);
|
||||
select 0xFF >> 2 ^ 0xF0, (0xFF >> 2) ^ 0xF0, 0xFF >> (2 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over binary +
|
||||
select 0xFF ^ 0xF0 + 0x0F, (0xFF ^ 0xF0) + 0x0F, 0xFF ^ (0xF0 + 0x0F);
|
||||
select 0x0F + 0xFF ^ 0xF0, (0x0F + 0xFF) ^ 0xF0, 0x0F + (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over binary -
|
||||
select 0xFF ^ 0xF0 - 1, (0xFF ^ 0xF0) - 1, 0xFF ^ (0xF0 - 1);
|
||||
select 0x55 - 0x0F ^ 0x55, (0x55 - 0x0F) ^ 0x55, 0x55 - (0x0F ^ 0x55);
|
||||
|
||||
--echo Testing that ^ has precedence over *
|
||||
select 0xFF ^ 0xF0 * 2, (0xFF ^ 0xF0) * 2, 0xFF ^ (0xF0 * 2);
|
||||
select 2 * 0xFF ^ 0xF0, (2 * 0xFF) ^ 0xF0, 2 * (0xFF ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over /
|
||||
select 0xFF ^ 0xF0 / 2, (0xFF ^ 0xF0) / 2, 0xFF ^ (0xF0 / 2);
|
||||
select 0xF2 / 2 ^ 0xF0, (0xF2 / 2) ^ 0xF0, 0xF2 / (2 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over %
|
||||
select 0xFF ^ 0xF0 % 0x20, (0xFF ^ 0xF0) % 0x20, 0xFF ^ (0xF0 % 0x20);
|
||||
select 0xFF % 0x20 ^ 0xF0, (0xFF % 0x20) ^ 0xF0, 0xFF % (0x20 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over DIV
|
||||
select 0xFF ^ 0xF0 DIV 2, (0xFF ^ 0xF0) DIV 2, 0xFF ^ (0xF0 DIV 2);
|
||||
select 0xF2 DIV 2 ^ 0xF0, (0xF2 DIV 2) ^ 0xF0, 0xF2 DIV (2 ^ 0xF0);
|
||||
|
||||
--echo Testing that ^ has precedence over MOD
|
||||
select 0xFF ^ 0xF0 MOD 0x20, (0xFF ^ 0xF0) MOD 0x20, 0xFF ^ (0xF0 MOD 0x20);
|
||||
select 0xFF MOD 0x20 ^ 0xF0, (0xFF MOD 0x20) ^ 0xF0, 0xFF MOD (0x20 ^ 0xF0);
|
||||
|
@ -82,8 +82,9 @@ enum precedence {
|
||||
XOR_PRECEDENCE, // XOR
|
||||
AND_PRECEDENCE, // AND, &&
|
||||
NOT_PRECEDENCE, // NOT (unless HIGH_NOT_PRECEDENCE)
|
||||
BETWEEN_PRECEDENCE, // BETWEEN, CASE, WHEN, THEN, ELSE
|
||||
CMP_PRECEDENCE, // =, <=>, >=, >, <=, <, <>, !=, IS, LIKE, REGEXP, IN
|
||||
CMP_PRECEDENCE, // =, <=>, >=, >, <=, <, <>, !=, IS
|
||||
BETWEEN_PRECEDENCE, // BETWEEN
|
||||
IN_PRECEDENCE, // IN, LIKE, REGEXP
|
||||
BITOR_PRECEDENCE, // |
|
||||
BITAND_PRECEDENCE, // &
|
||||
SHIFT_PRECEDENCE, // <<, >>
|
||||
@ -1381,6 +1382,8 @@ public:
|
||||
mysql_register_view().
|
||||
*/
|
||||
virtual enum precedence precedence() const { return DEFAULT_PRECEDENCE; }
|
||||
enum precedence higher_precedence() const
|
||||
{ return (enum precedence)(precedence() + 1); }
|
||||
void print_parenthesised(String *str, enum_query_type query_type,
|
||||
enum precedence parent_prec);
|
||||
/**
|
||||
|
@ -2312,7 +2312,7 @@ longlong Item_func_between::val_int()
|
||||
|
||||
void Item_func_between::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
args[0]->print_parenthesised(str, query_type, precedence());
|
||||
args[0]->print_parenthesised(str, query_type, higher_precedence());
|
||||
if (negated)
|
||||
str->append(STRING_WITH_LEN(" not"));
|
||||
str->append(STRING_WITH_LEN(" between "));
|
||||
@ -3375,15 +3375,15 @@ void Item_func_case::print(String *str, enum_query_type query_type)
|
||||
for (uint i= first_expr_num + 1 ; i < nwhens + first_expr_num + 1; i++)
|
||||
{
|
||||
str->append(STRING_WITH_LEN("when "));
|
||||
args[i]->print_parenthesised(str, query_type, precedence());
|
||||
args[i]->print(str, query_type);
|
||||
str->append(STRING_WITH_LEN(" then "));
|
||||
args[i+nwhens]->print_parenthesised(str, query_type, precedence());
|
||||
args[i+nwhens]->print(str, query_type);
|
||||
str->append(' ');
|
||||
}
|
||||
if (else_expr_num != -1)
|
||||
{
|
||||
str->append(STRING_WITH_LEN("else "));
|
||||
args[else_expr_num]->print_parenthesised(str, query_type, precedence());
|
||||
args[else_expr_num]->print(str, query_type);
|
||||
str->append(' ');
|
||||
}
|
||||
str->append(STRING_WITH_LEN("end"));
|
||||
@ -5243,12 +5243,14 @@ void Item_func_like::print(String *str, enum_query_type query_type)
|
||||
str->append(STRING_WITH_LEN(" not "));
|
||||
str->append(func_name());
|
||||
str->append(' ');
|
||||
args[1]->print_parenthesised(str, query_type, precedence());
|
||||
if (escape_used_in_parsing)
|
||||
{
|
||||
args[1]->print_parenthesised(str, query_type, precedence());
|
||||
str->append(STRING_WITH_LEN(" escape "));
|
||||
escape_item->print(str, query_type);
|
||||
escape_item->print_parenthesised(str, query_type, higher_precedence());
|
||||
}
|
||||
else
|
||||
args[1]->print_parenthesised(str, query_type, higher_precedence());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1590,7 +1590,6 @@ public:
|
||||
uint decimal_precision() const;
|
||||
table_map not_null_tables() const { return 0; }
|
||||
const char *func_name() const { return "case"; }
|
||||
enum precedence precedence() const { return BETWEEN_PRECEDENCE; }
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
Item *find_item(String *str);
|
||||
CHARSET_INFO *compare_collation() const { return cmp_collation.collation; }
|
||||
@ -1704,7 +1703,7 @@ public:
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
enum Functype functype() const { return IN_FUNC; }
|
||||
const char *func_name() const { return "in"; }
|
||||
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
bool eval_not_null_tables(void *opt_arg);
|
||||
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
|
||||
bool count_sargable_conds(void *arg);
|
||||
@ -1999,7 +1998,7 @@ public:
|
||||
return this;
|
||||
}
|
||||
const char *func_name() const { return "like"; }
|
||||
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
@ -2127,7 +2126,7 @@ public:
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
bool fix_length_and_dec();
|
||||
const char *func_name() const { return "regexp"; }
|
||||
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return 0; }
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
|
@ -481,8 +481,7 @@ void Item_func::print_op(String *str, enum_query_type query_type)
|
||||
str->append(func_name());
|
||||
str->append(' ');
|
||||
}
|
||||
args[arg_count-1]->print_parenthesised(str, query_type,
|
||||
(enum precedence)(precedence() + 1));
|
||||
args[arg_count-1]->print_parenthesised(str, query_type, higher_precedence());
|
||||
}
|
||||
|
||||
|
||||
|
@ -3283,7 +3283,7 @@ void Item_in_subselect::print(String *str, enum_query_type query_type)
|
||||
str->append(STRING_WITH_LEN("<exists>"));
|
||||
else
|
||||
{
|
||||
left_expr->print(str, query_type);
|
||||
left_expr->print_parenthesised(str, query_type, precedence());
|
||||
str->append(STRING_WITH_LEN(" in "));
|
||||
}
|
||||
Item_subselect::print(str, query_type);
|
||||
|
@ -628,7 +628,7 @@ public:
|
||||
bool val_bool();
|
||||
bool test_limit(st_select_lex_unit *unit);
|
||||
void print(String *str, enum_query_type query_type);
|
||||
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
bool fix_length_and_dec();
|
||||
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
|
||||
|
127
sql/sql_yacc.yy
127
sql/sql_yacc.yy
@ -149,6 +149,14 @@ void LEX::parse_error()
|
||||
}
|
||||
|
||||
|
||||
static Item* escape(THD *thd)
|
||||
{
|
||||
thd->lex->escape_used= false;
|
||||
const char *esc= thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES ? "" : "\\";
|
||||
return new (thd->mem_root) Item_string_ascii(thd, esc, MY_TEST(esc[0]));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@brief Bison callback to report a syntax/OOM error
|
||||
|
||||
@ -1022,10 +1030,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
||||
%parse-param { THD *thd }
|
||||
%lex-param { THD *thd }
|
||||
/*
|
||||
Currently there are 102 shift/reduce conflicts.
|
||||
Currently there are 105 shift/reduce conflicts.
|
||||
We should not introduce new conflicts any more.
|
||||
*/
|
||||
%expect 101
|
||||
%expect 105
|
||||
|
||||
/*
|
||||
Comments for TOKENS.
|
||||
@ -1721,17 +1729,19 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
||||
%left OR_OR_SYM OR_SYM OR2_SYM
|
||||
%left XOR
|
||||
%left AND_SYM AND_AND_SYM
|
||||
%left BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
|
||||
%left '=' EQUAL_SYM GE '>' LE '<' NE IS LIKE REGEXP IN_SYM
|
||||
%nonassoc NOT_SYM
|
||||
%left '=' EQUAL_SYM GE '>' LE '<' NE
|
||||
%nonassoc IS
|
||||
%right BETWEEN_SYM
|
||||
%left LIKE REGEXP IN_SYM
|
||||
%left '|'
|
||||
%left '&'
|
||||
%left SHIFT_LEFT SHIFT_RIGHT
|
||||
%left '-' '+'
|
||||
%left '*' '/' '%' DIV_SYM MOD_SYM
|
||||
%left '^'
|
||||
%left NEG '~'
|
||||
%right NOT_SYM NOT2_SYM
|
||||
%right BINARY COLLATE_SYM
|
||||
%nonassoc NEG '~' NOT2_SYM BINARY
|
||||
%nonassoc COLLATE_SYM
|
||||
%left INTERVAL_SYM
|
||||
|
||||
%type <lex_str>
|
||||
@ -1831,7 +1841,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
||||
table_wild simple_expr column_default_non_parenthesized_expr udf_expr
|
||||
expr_or_default set_expr_or_default
|
||||
geometry_function signed_literal expr_or_literal
|
||||
opt_escape
|
||||
sp_opt_default
|
||||
simple_ident_nospvar simple_ident_q
|
||||
field_or_var limit_option
|
||||
@ -8915,37 +8924,49 @@ expr:
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bool_pri IS TRUE_SYM %prec IS
|
||||
| expr IS TRUE_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_istrue(thd, $1);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bool_pri IS not TRUE_SYM %prec IS
|
||||
| expr IS not TRUE_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_isnottrue(thd, $1);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bool_pri IS FALSE_SYM %prec IS
|
||||
| expr IS FALSE_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_isfalse(thd, $1);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bool_pri IS not FALSE_SYM %prec IS
|
||||
| expr IS not FALSE_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_isnotfalse(thd, $1);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bool_pri IS UNKNOWN_SYM %prec IS
|
||||
| expr IS UNKNOWN_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bool_pri IS not UNKNOWN_SYM %prec IS
|
||||
| expr IS not UNKNOWN_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| expr IS NULL_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| expr IS not NULL_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
|
||||
if ($$ == NULL)
|
||||
@ -8955,19 +8976,7 @@ expr:
|
||||
;
|
||||
|
||||
bool_pri:
|
||||
bool_pri IS NULL_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_isnull(thd, $1);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bool_pri IS not NULL_SYM %prec IS
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_isnotnull(thd, $1);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
|
||||
bool_pri EQUAL_SYM predicate %prec EQUAL_SYM
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_equal(thd, $1, $3);
|
||||
if ($$ == NULL)
|
||||
@ -8989,13 +8998,13 @@ bool_pri:
|
||||
;
|
||||
|
||||
predicate:
|
||||
bit_expr IN_SYM '(' subselect ')'
|
||||
predicate IN_SYM '(' subselect ')'
|
||||
{
|
||||
$$= new (thd->mem_root) Item_in_subselect(thd, $1, $4);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bit_expr not IN_SYM '(' subselect ')'
|
||||
| predicate not IN_SYM '(' subselect ')'
|
||||
{
|
||||
Item *item= new (thd->mem_root) Item_in_subselect(thd, $1, $5);
|
||||
if (item == NULL)
|
||||
@ -9004,13 +9013,13 @@ predicate:
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bit_expr IN_SYM '(' expr ')'
|
||||
| predicate IN_SYM '(' expr ')'
|
||||
{
|
||||
$$= handle_sql2003_note184_exception(thd, $1, true, $4);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bit_expr IN_SYM '(' expr ',' expr_list ')'
|
||||
| predicate IN_SYM '(' expr ',' expr_list ')'
|
||||
{
|
||||
$6->push_front($4, thd->mem_root);
|
||||
$6->push_front($1, thd->mem_root);
|
||||
@ -9018,13 +9027,13 @@ predicate:
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bit_expr not IN_SYM '(' expr ')'
|
||||
| predicate not IN_SYM '(' expr ')'
|
||||
{
|
||||
$$= handle_sql2003_note184_exception(thd, $1, false, $5);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bit_expr not IN_SYM '(' expr ',' expr_list ')'
|
||||
| predicate not IN_SYM '(' expr ',' expr_list ')'
|
||||
{
|
||||
$7->push_front($5, thd->mem_root);
|
||||
$7->push_front($1, thd->mem_root);
|
||||
@ -9033,13 +9042,13 @@ predicate:
|
||||
MYSQL_YYABORT;
|
||||
$$= item->neg_transformer(thd);
|
||||
}
|
||||
| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
|
||||
| predicate BETWEEN_SYM predicate AND_SYM predicate %prec BETWEEN_SYM
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_between(thd, $1, $3, $5);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
|
||||
| predicate not BETWEEN_SYM predicate AND_SYM predicate %prec BETWEEN_SYM
|
||||
{
|
||||
Item_func_between *item;
|
||||
item= new (thd->mem_root) Item_func_between(thd, $1, $4, $6);
|
||||
@ -9047,7 +9056,7 @@ predicate:
|
||||
MYSQL_YYABORT;
|
||||
$$= item->neg_transformer(thd);
|
||||
}
|
||||
| bit_expr SOUNDS_SYM LIKE bit_expr
|
||||
| predicate SOUNDS_SYM LIKE predicate
|
||||
{
|
||||
Item *item1= new (thd->mem_root) Item_func_soundex(thd, $1);
|
||||
Item *item4= new (thd->mem_root) Item_func_soundex(thd, $4);
|
||||
@ -9057,28 +9066,41 @@ predicate:
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bit_expr LIKE simple_expr opt_escape
|
||||
| predicate LIKE predicate
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_like(thd, $1, $3, $4,
|
||||
Lex->escape_used);
|
||||
$$= new (thd->mem_root) Item_func_like(thd, $1, $3, escape(thd), false);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bit_expr not LIKE simple_expr opt_escape
|
||||
| predicate LIKE predicate ESCAPE_SYM predicate %prec LIKE
|
||||
{
|
||||
Item *item= new (thd->mem_root) Item_func_like(thd, $1, $4, $5,
|
||||
Lex->escape_used);
|
||||
Lex->escape_used= true;
|
||||
$$= new (thd->mem_root) Item_func_like(thd, $1, $3, $5, true);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| predicate not LIKE predicate
|
||||
{
|
||||
Item *item= new (thd->mem_root) Item_func_like(thd, $1, $4, escape(thd), false);
|
||||
if (item == NULL)
|
||||
MYSQL_YYABORT;
|
||||
$$= item->neg_transformer(thd);
|
||||
}
|
||||
| bit_expr REGEXP bit_expr
|
||||
| predicate not LIKE predicate ESCAPE_SYM predicate %prec LIKE
|
||||
{
|
||||
Lex->escape_used= true;
|
||||
Item *item= new (thd->mem_root) Item_func_like(thd, $1, $4, $6, true);
|
||||
if (item == NULL)
|
||||
MYSQL_YYABORT;
|
||||
$$= item->neg_transformer(thd);
|
||||
}
|
||||
| predicate REGEXP predicate
|
||||
{
|
||||
$$= new (thd->mem_root) Item_func_regex(thd, $1, $3);
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| bit_expr not REGEXP bit_expr
|
||||
| predicate not REGEXP predicate
|
||||
{
|
||||
Item *item= new (thd->mem_root) Item_func_regex(thd, $1, $4);
|
||||
if (item == NULL)
|
||||
@ -11468,23 +11490,6 @@ opt_having_clause:
|
||||
}
|
||||
;
|
||||
|
||||
opt_escape:
|
||||
ESCAPE_SYM simple_expr
|
||||
{
|
||||
Lex->escape_used= TRUE;
|
||||
$$= $2;
|
||||
}
|
||||
| /* empty */
|
||||
{
|
||||
Lex->escape_used= FALSE;
|
||||
$$= ((thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
|
||||
new (thd->mem_root) Item_string_ascii(thd, "", 0) :
|
||||
new (thd->mem_root) Item_string_ascii(thd, "\\", 1));
|
||||
if ($$ == NULL)
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
;
|
||||
|
||||
/*
|
||||
group by statement in select
|
||||
*/
|
||||
|
Reference in New Issue
Block a user