Debian Codegraph @

mysql-test/suite/versioning/r/select2.result

raw
1 create table t1(
2 x int unsigned,
3 y int unsigned,
4 sys_start SYS_TYPE as row start invisible,
5 sys_end SYS_TYPE as row end invisible,
6 period for system_time (sys_start, sys_end))
7 with system versioning engine=ENGINE;
8 insert into t1 (x, y) values
9 (0, 100),
10 (1, 101),
11 (2, 102),
12 (3, 103),
13 (4, 104),
14 (5, 105),
15 (6, 106),
16 (7, 107),
17 (8, 108),
18 (9, 109);
19 set @t0= now(6);
20 select sys_start from t1 limit 1 into @x0;
21 delete from t1 where x = 3;
22 delete from t1 where x > 7;
23 insert into t1(x, y) values(3, 33);
24 select sys_start from t1 where x = 3 and y = 33 into @t1;
25 select x, y from t1;
26 x y
27 0 100
28 1 101
29 2 102
30 4 104
31 5 105
32 6 106
33 7 107
34 3 33
35 select x as ASOF_x, y from t1 for system_time as of timestamp @t0;
36 ASOF_x y
37 0 100
38 1 101
39 2 102
40 3 103
41 4 104
42 5 105
43 6 106
44 7 107
45 8 108
46 9 109
47 select x as FROMTO_x, y from t1 for system_time from '1970-01-01 00:00' to timestamp @t1;
48 FROMTO_x y
49 0 100
50 1 101
51 2 102
52 3 103
53 4 104
54 5 105
55 6 106
56 7 107
57 8 108
58 9 109
59 select x as BETWAND_x, y from t1 for system_time between '1970-01-01 00:00' and timestamp @t1;
60 BETWAND_x y
61 0 100
62 1 101
63 2 102
64 3 103
65 4 104
66 5 105
67 6 106
68 7 107
69 8 108
70 9 109
71 3 33
72 select x as ALL_x, y from t1 for system_time all;
73 ALL_x y
74 0 100
75 1 101
76 2 102
77 3 103
78 4 104
79 5 105
80 6 106
81 7 107
82 8 108
83 9 109
84 3 33
85 select x as ASOF2_x, y from t1 for system_time as of @t0;
86 ASOF2_x y
87 0 100
88 1 101
89 2 102
90 3 103
91 4 104
92 5 105
93 6 106
94 7 107
95 8 108
96 9 109
97 select x as FROMTO2_x, y from t1 for system_time from '1970-01-01 00:00' to @t1;
98 FROMTO2_x y
99 0 100
100 1 101
101 2 102
102 3 103
103 4 104
104 5 105
105 6 106
106 7 107
107 8 108
108 9 109
109 select x as BETWAND2_x, y from t1 for system_time between '1970-01-01 00:00' and timestamp @t1;
110 BETWAND2_x y
111 0 100
112 1 101
113 2 102
114 3 103
115 4 104
116 5 105
117 6 106
118 7 107
119 8 108
120 9 109
121 3 33
122 drop table t1;
123 create table t1(
124 x int,
125 y int,
126 sys_start SYS_TYPE as row start invisible,
127 sys_end SYS_TYPE as row end invisible,
128 period for system_time (sys_start, sys_end))
129 with system versioning engine=ENGINE;
130 create table t2 like t1;
131 insert into t1 values (1, 1), (1, 2), (1, 3), (4, 4), (5, 5);
132 insert into t2 values (1, 2), (2, 1), (3, 1);
133 set @t0= now(6);
134 select t1.x as IJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x;
135 IJ1_x1 y1 x2 y2
136 1 1 1 2
137 1 2 1 2
138 1 3 1 2
139 select t1.x as LJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x;
140 LJ1_x1 y1 x2 y2
141 1 1 1 2
142 1 2 1 2
143 1 3 1 2
144 4 4 NULL NULL
145 5 5 NULL NULL
146 select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x;
147 RJ1_x1 y1 x2 y2
148 1 1 1 2
149 1 2 1 2
150 1 3 1 2
151 NULL NULL 2 1
152 NULL NULL 3 1
153 delete from t1;
154 delete from t2;
155 select IJ2_x1,y1,x2,y2 from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x)
156 for system_time as of timestamp @t0 as t;
157 IJ2_x1 y1 x2 y2
158 1 1 1 2
159 1 2 1 2
160 1 3 1 2
161 select LJ2_x1,y1,x2,y2 from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x)
162 for system_time as of timestamp @t0 as t;
163 LJ2_x1 y1 x2 y2
164 1 1 1 2
165 1 2 1 2
166 1 3 1 2
167 4 4 NULL NULL
168 5 5 NULL NULL
169 select RJ2_x1,y1,x2,y2 from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x)
170 for system_time as of timestamp @t0 as t;
171 RJ2_x1 y1 x2 y2
172 1 1 1 2
173 1 2 1 2
174 1 3 1 2
175 NULL NULL 2 1
176 NULL NULL 3 1
177 drop table t1;
178 drop table t2;
179 # MDEV-14686 Server crashes in Item_field::used_tables on 2nd call of SP [#422]
180 create or replace table t1 (called int, bad int) with system versioning;
181 create or replace procedure bad() select * from t1 where bad in (select called from t1);
182 called bad
183 called bad
184 called bad
185 called bad
186 called bad
187 called bad
188 called bad
189 called bad
190 # bad() is good.
191 # MDEV-14751 Server crashes in TABLE::versioned on 2nd execution of SP [#431]
192 create or replace table t1 (called_bad int);
193 create or replace table t2 (b int);
194 create or replace procedure bad() select * from t1 where ( 5, 6 ) in ( select b, b from t2 ) and called_bad in ( select max(b) from t2 );
195 called_bad
196 called_bad
197 called_bad
198 called_bad
199 called_bad
200 called_bad
201 called_bad
202 called_bad
203 # bad() is good.
204 # MDEV-14786 Server crashes in Item_cond::transform on 2nd execution of SP querying from a view [#436]
205 create or replace table t1 (called_bad int) with system versioning;
206 create or replace view v1 as select called_bad from t1 where called_bad < 5;
207 create or replace procedure bad() select called_bad from v1;
208 called_bad
209 called_bad
210 called_bad
211 called_bad
212 called_bad
213 called_bad
214 called_bad
215 called_bad
216 # bad() is good.
217 # wildcard expansion on hidden fields.
218 create or replace table t1(
219 A int
220 ) with system versioning;
221 insert into t1 values(1);
222 select * from t1;
223 A
224 1
225 create or replace table t1 (x int);
226 insert into t1 values (1);
227 select * from t1 for system_time all;
228 ERROR HY000: Table `t1` is not system-versioned
229 create or replace table t1 (x int) with system versioning;
230 insert into t1 values (1);
231 select * from t1 for system_time as of now() for update;
232 ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
233 create or replace table t1 (a int not null auto_increment primary key) with system versioning;
234 select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
235 a
236 create or replace table t1 (a int) with system versioning;
237 create or replace table t2 (a int) with system versioning;
238 insert into t1 values(1);
239 insert into t2 values(1);
240 create or replace view v1 as select * from t2 inner join t1 using (a);
241 select * from v1;
242 a
243 1
244 drop view v1;
245 create or replace table t1 (a int) with system versioning;
246 insert into t1 values (1);
247 create view vt1 as select a from t1;
248 select * from t1 natural join vt1;
249 a
250 1
251 drop view vt1;
252 create or replace table t1(x int) with system versioning;
253 select * from (t1 as r left join t1 as u using (x)), t1;
254 x x
255 create or replace table t1 (a int) with system versioning;
256 insert into t1 values (1);
257 create trigger read_end after update on t1
258 for each row set @end = old.row_end;
259 update t1 set a=2;
260 select @end;
261 @end
262 MAX_RESULT
263 create or replace table t1 (a int) with system versioning;
264 create or replace table t2 (b int) with system versioning;
265 insert into t1 values (1);
266 insert into t2 values (2);
267 select * from (select * from t1 cross join t2) as tmp;
268 a b
269 1 2
270 select * from (select * from (select * from t1 cross join t2) as tmp1) as tmp2;
271 a b
272 1 2
273 select * from (select * from t1 cross join t2 for system_time as of timestamp ('1970-01-01 00:00')) as tmp;
274 a b
275 create or replace table t1(a1 int) with system versioning;
276 create or replace table t2(a2 int) with system versioning;
277 insert into t1 values(1),(2);
278 insert into t2 values(1),(2);
279 select * from t1 for system_time all natural left join t2 for system_time all;
280 a1 a2
281 1 1
282 2 1
283 1 2
284 2 2
285 create or replace table t1(a1 int) with system versioning;
286 create or replace table t2(a2 int) with system versioning;
287 insert into t1 values(1),(2);
288 insert into t2 values(1),(2);
289 create or replace view v1 as select a1 from t1;
290 select * from v1 natural join t2;
291 a1 a2
292 1 1
293 2 1
294 1 2
295 2 2
296 select * from v1 natural left join t2;
297 a1 a2
298 1 1
299 2 1
300 1 2
301 2 2
302 select * from v1 natural right join t2;
303 a2 a1
304 1 1
305 2 1
306 1 2
307 2 2
308 create or replace table t1 (a int) with system versioning;
309 insert into t1 values (1);
310 insert into t1 values (2);
311 insert into t1 values (3);
312 select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
313 a a
314 2 1
315 3 1
316 2 2
317 3 2
318 2 3
319 3 3
320 1 NULL
321 create or replace table t1 (x int) with system versioning;
322 create or replace table t2 (y int) with system versioning;
323 insert into t1 values (1), (2), (3);
324 delete from t1 where x = 3;
325 insert into t2 values (1);
326 select * from t1, t2 for system_time all;
327 x y
328 1 1
329 2 1
330 select * from (select * from t1 for system_time all, t2 for system_time all) for system_time all as t;
331 ERROR HY000: Table `t` is not system-versioned
332 select * from (t1 for system_time all join t2 for system_time all) for system_time all;
333 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 'system_time all' at line 1
334 # MDEV-16043 Assertion thd->Item_change_list::is_empty() failed in mysql_parse upon SELECT from a view reading from a versioned table
335 create or replace table t1 (a int) with system versioning;
336 create or replace view v1 as select * from t1;
337 prepare stmt from "select * from t1 where exp( '20010609211642053929' )";
338 execute stmt;
339 ERROR 22003: DOUBLE value is out of range in 'exp('20010609211642053929')'
340 select a from v1;
341 a
342 drop view v1;
343 drop table t1, t2;