@@ -268,6 +268,77 @@ select 1e-308, 1.00000001e-300, 100000000e-300;
268268select 10e307;
26926910e307
2702701e+308
271+ create table t1(a int, b double(8, 2));
272+ insert into t1 values
273+ (1, 28.50), (1, 121.85), (1, 157.23), (1, 1351.00), (1, -1965.35), (1, 81.75),
274+ (1, 217.08), (1, 7.94), (4, 96.07), (4, 6404.65), (4, -6500.72), (2, 100.00),
275+ (5, 5.00), (5, -2104.80), (5, 2033.80), (5, 0.07), (5, 65.93),
276+ (3, -4986.24), (3, 5.00), (3, 4857.34), (3, 123.74), (3, 0.16),
277+ (6, -1695.31), (6, 1003.77), (6, 499.72), (6, 191.82);
278+ explain select sum(b) s from t1 group by a;
279+ id select_type table type possible_keys key key_len ref rows Extra
280+ 1 SIMPLE t1 ALL NULL NULL NULL NULL 26 Using temporary; Using filesort
281+ select sum(b) s from t1 group by a;
282+ s
283+ 0.00
284+ 100.00
285+ 0.00
286+ -0.00
287+ -0.00
288+ 0.00
289+ select sum(b) s from t1 group by a having s <> 0;
290+ s
291+ 100.00
292+ select sum(b) s from t1 group by a having s <> 0 order by s;
293+ s
294+ 100.00
295+ select sum(b) s from t1 group by a having s <=> 0;
296+ s
297+ 0.00
298+ 0.00
299+ -0.00
300+ -0.00
301+ 0.00
302+ select sum(b) s from t1 group by a having s <=> 0 order by s;
303+ s
304+ -0.00
305+ -0.00
306+ 0.00
307+ 0.00
308+ 0.00
309+ alter table t1 add key (a, b);
310+ explain select sum(b) s from t1 group by a;
311+ id select_type table type possible_keys key key_len ref rows Extra
312+ 1 SIMPLE t1 index NULL a 14 NULL 26 Using index
313+ select sum(b) s from t1 group by a;
314+ s
315+ 0.00
316+ 100.00
317+ 0.00
318+ -0.00
319+ 0.00
320+ 0.00
321+ select sum(b) s from t1 group by a having s <> 0;
322+ s
323+ 100.00
324+ select sum(b) s from t1 group by a having s <> 0 order by s;
325+ s
326+ 100.00
327+ select sum(b) s from t1 group by a having s <=> 0;
328+ s
329+ 0.00
330+ 0.00
331+ -0.00
332+ 0.00
333+ 0.00
334+ select sum(b) s from t1 group by a having s <=> 0 order by s;
335+ s
336+ -0.00
337+ 0.00
338+ 0.00
339+ 0.00
340+ 0.00
341+ drop table t1;
271342End of 4.1 tests
272343create table t1 (s1 float(0,2));
273344ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
0 commit comments