~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/parser_precedence.test

  • Committer: Mats Kindahl
  • Date: 2008-08-26 07:32:59 UTC
  • mto: (489.1.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: mats@mysql.com-20080826073259-9k4evtajgldgolli
Replaced use of thd_proc_info() macro with calls to
set_proc_info() and get_proc_info() internally.  Introduced
functions set_thd_proc_info() and get_thd_proc_info() for
external users, i.e., plug-ins.

The set_thd_proc_info() accepted callers info that can be used to
print debug output, but the information was not used. The return
value was changed to void and the old value is not fetched any
more. To be able to get the value of proc_info for external
users, the function get_thd_proc_info() was introduced.

The thd_proc_info() macro called set_thd_proc_info() but almost
never used the return value of set_thd_proc_info() so the macro
was replaced with a call of THD::set_proc_info().

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
--disable_warnings
3
 
drop table if exists t1_30237_bool;
4
 
--enable_warnings
5
 
 
6
 
create table t1_30237_bool(A char, B char, C char);
7
 
 
8
 
insert into t1_30237_bool values
9
 
(FALSE, FALSE, FALSE),
10
 
(FALSE, FALSE, NULL),
11
 
(FALSE, FALSE, TRUE),
12
 
(FALSE, NULL, FALSE),
13
 
(FALSE, NULL, NULL),
14
 
(FALSE, NULL, TRUE),
15
 
(FALSE, TRUE, FALSE),
16
 
(FALSE, TRUE, NULL),
17
 
(FALSE, TRUE, TRUE),
18
 
(NULL, FALSE, FALSE),
19
 
(NULL, FALSE, NULL),
20
 
(NULL, FALSE, TRUE),
21
 
(NULL, NULL, FALSE),
22
 
(NULL, NULL, NULL),
23
 
(NULL, NULL, TRUE),
24
 
(NULL, TRUE, FALSE),
25
 
(NULL, TRUE, NULL),
26
 
(NULL, TRUE, TRUE),
27
 
(TRUE, FALSE, FALSE),
28
 
(TRUE, FALSE, NULL),
29
 
(TRUE, FALSE, TRUE),
30
 
(TRUE, NULL, FALSE),
31
 
(TRUE, NULL, NULL),
32
 
(TRUE, NULL, TRUE),
33
 
(TRUE, TRUE, FALSE),
34
 
(TRUE, TRUE, NULL),
35
 
(TRUE, TRUE, TRUE) ;
36
 
 
37
 
--echo Testing OR, XOR, AND
38
 
select A, B, A OR B, A XOR B, A AND B
39
 
  from t1_30237_bool where C is null order by A, B;
40
 
 
41
 
--echo Testing that OR is associative 
42
 
select A, B, C, (A OR B) OR C, A OR (B OR C), A OR B OR C
43
 
 from t1_30237_bool order by A, B, C;
44
 
 
45
 
select count(*) from t1_30237_bool
46
 
  where ((A OR B) OR C) != (A OR (B OR C));
47
 
 
48
 
--echo Testing that XOR is associative 
49
 
select A, B, C, (A XOR B) XOR C, A XOR (B XOR C), A XOR B XOR C
50
 
  from t1_30237_bool order by A, B, C;
51
 
 
52
 
select count(*) from t1_30237_bool
53
 
  where ((A XOR B) XOR C) != (A XOR (B XOR C));
54
 
 
55
 
--echo Testing that AND is associative 
56
 
select A, B, C, (A AND B) AND C, A AND (B AND C), A AND B AND C
57
 
  from t1_30237_bool order by A, B, C;
58
 
 
59
 
select count(*) from t1_30237_bool
60
 
  where ((A AND B) AND C) != (A AND (B AND C));
61
 
 
62
 
--echo Testing that AND has precedence over OR
63
 
select A, B, C, (A OR B) AND C, A OR (B AND C), A OR B AND C
64
 
  from t1_30237_bool order by A, B, C;
65
 
select count(*) from t1_30237_bool
66
 
  where (A OR (B AND C)) != (A OR B AND C);
67
 
select A, B, C, (A AND B) OR C, A AND (B OR C), A AND B OR C
68
 
  from t1_30237_bool order by A, B, C;
69
 
select count(*) from t1_30237_bool
70
 
  where ((A AND B) OR C) != (A AND B OR C);
71
 
 
72
 
--echo Testing that AND has precedence over XOR
73
 
select A, B, C, (A XOR B) AND C, A XOR (B AND C), A XOR B AND C
74
 
  from t1_30237_bool order by A, B, C;
75
 
select count(*) from t1_30237_bool
76
 
  where (A XOR (B AND C)) != (A XOR B AND C);
77
 
select A, B, C, (A AND B) XOR C, A AND (B XOR C), A AND B XOR C
78
 
  from t1_30237_bool order by A, B, C;
79
 
select count(*) from t1_30237_bool
80
 
  where ((A AND B) XOR C) != (A AND B XOR C);
81
 
 
82
 
--echo Testing that XOR has precedence over OR
83
 
select A, B, C, (A XOR B) OR C, A XOR (B OR C), A XOR B OR C
84
 
  from t1_30237_bool order by A, B, C;
85
 
select count(*) from t1_30237_bool
86
 
  where ((A XOR B) OR C) != (A XOR B OR C);
87
 
select A, B, C, (A OR B) XOR C, A OR (B XOR C), A OR B XOR C
88
 
  from t1_30237_bool order by A, B, C;
89
 
select count(*) from t1_30237_bool
90
 
  where (A OR (B XOR C)) != (A OR B XOR C);
91
 
 
92
 
drop table t1_30237_bool;
93
 
 
94
 
--echo Testing that NOT has precedence over OR
95
 
select (NOT FALSE) OR TRUE, NOT (FALSE OR TRUE), NOT FALSE OR TRUE;
96
 
 
97
 
--echo Testing that NOT has precedence over XOR
98
 
select (NOT FALSE) XOR FALSE, NOT (FALSE XOR FALSE), NOT FALSE XOR FALSE;
99
 
 
100
 
--echo Testing that NOT has precedence over AND
101
 
select (NOT FALSE) AND FALSE, NOT (FALSE AND FALSE), NOT FALSE AND FALSE;
102
 
 
103
 
--echo Testing that NOT is associative
104
 
select NOT NOT TRUE, NOT NOT NOT FALSE;
105
 
 
106
 
--echo Testing that IS has precedence over NOT
107
 
select (NOT NULL) IS TRUE, NOT (NULL IS TRUE), NOT NULL IS TRUE;
108
 
select (NOT NULL) IS NOT TRUE, NOT (NULL IS NOT TRUE), NOT NULL IS NOT TRUE;
109
 
select (NOT NULL) IS FALSE, NOT (NULL IS FALSE), NOT NULL IS FALSE;
110
 
select (NOT NULL) IS NOT FALSE, NOT (NULL IS NOT FALSE), NOT NULL IS NOT FALSE;
111
 
select (NOT TRUE) IS UNKNOWN, NOT (TRUE IS UNKNOWN), NOT TRUE IS UNKNOWN;
112
 
select (NOT TRUE) IS NOT UNKNOWN, NOT (TRUE IS NOT UNKNOWN), NOT TRUE IS NOT UNKNOWN;
113
 
select (NOT TRUE) IS NULL, NOT (TRUE IS NULL), NOT TRUE IS NULL;
114
 
select (NOT TRUE) IS NOT NULL, NOT (TRUE IS NOT NULL), NOT TRUE IS NOT NULL;
115
 
 
116
 
--echo Testing that IS [NOT] TRUE/FALSE/UNKNOWN predicates are not associative
117
 
# Documenting existing behavior in 5.0.48
118
 
select TRUE IS TRUE IS TRUE IS TRUE;
119
 
select FALSE IS NOT TRUE IS NOT TRUE IS NOT TRUE;
120
 
select NULL IS FALSE IS FALSE IS FALSE;
121
 
select TRUE IS NOT FALSE IS NOT FALSE IS NOT FALSE;
122
 
select FALSE IS UNKNOWN IS UNKNOWN IS UNKNOWN;
123
 
select TRUE IS NOT UNKNOWN IS NOT UNKNOWN IS NOT UNKNOWN;
124
 
 
125
 
--echo Testing that IS [NOT] NULL predicates are associative
126
 
# Documenting existing behavior in 5.0.48
127
 
select FALSE IS NULL IS NULL IS NULL;
128
 
select TRUE IS NOT NULL IS NOT NULL IS NOT NULL;
129
 
 
130
 
--echo Testing that comparison operators are left associative
131
 
select 1 <=> 2 <=> 2, (1 <=> 2) <=> 2, 1 <=> (2 <=> 2);
132
 
select 1 = 2 = 2, (1 = 2) = 2, 1 = (2 = 2);
133
 
select 1 != 2 != 3, (1 != 2) != 3, 1 != (2 != 3);
134
 
select 1 <> 2 <> 3, (1 <> 2) <> 3, 1 <> (2 <> 3);
135
 
select 1 < 2 < 3, (1 < 2) < 3, 1 < (2 < 3);
136
 
select 3 <= 2 <= 1, (3 <= 2) <= 1, 3 <= (2 <= 1);
137
 
select 1 > 2 > 3, (1 > 2) > 3, 1 > (2 > 3);
138
 
select 1 >= 2 >= 3, (1 >= 2) >= 3, 1 >= (2 >= 3);
139
 
 
140
 
--echo Testing that binary + is associative
141
 
select 1 + 2 + 3, (1 + 2) + 3, 1 + (2 + 3);
142
 
 
143
 
--echo Testing that binary - is left associative
144
 
select 1 - 2 - 3, (1 - 2) - 3, 1 - (2 - 3);
145
 
 
146
 
--echo Testing that binary + and binary - have the same precedence
147
 
# evaluated left to right
148
 
select 1 + 2 - 3, (1 + 2) - 3, 1 + (2 - 3);
149
 
select 1 - 2 + 3, (1 - 2) + 3, 1 - (2 + 3);
150
 
 
151
 
--echo Testing that * is associative
152
 
select 2 * 3 * 4, (2 * 3) * 4, 2 * (3 * 4);
153
 
 
154
 
--echo Testing that * has precedence over binary +
155
 
select 2 * 3 + 4, (2 * 3) + 4, 2 * (3 + 4);
156
 
select 2 + 3 * 4, (2 + 3) * 4, 2 + (3 * 4);
157
 
 
158
 
--echo Testing that * has precedence over binary -
159
 
select 4 * 3 - 2, (4 * 3) - 2, 4 * (3 - 2);
160
 
select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2);
161
 
 
162
 
--echo Testing that / is left associative
163
 
select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3);
164
 
 
165
 
--echo Testing that / has precedence over binary +
166
 
select 0x80 / 2 + 2, (0x80 / 2) + 2, 0x80 / (2 + 2);
167
 
select 0x80 + 2 / 2, (0x80 + 2) / 2, 0x80 + (2 / 2);
168
 
 
169
 
--echo Testing that / has precedence over binary -
170
 
select 0x80 / 4 - 2, (0x80 / 4) - 2, 0x80 / (4 - 2);
171
 
select 0x80 - 4 / 2, (0x80 - 4) / 2, 0x80 - (4 / 2);