mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge with 4.0
This commit is contained in:
@ -221,6 +221,68 @@ select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
|
||||
max(t1.a2) max(t2.a1)
|
||||
zzz BBB
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||
count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
insert into t1 values (1,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1 1
|
||||
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select high_priority big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
|
||||
drop table t1;
|
||||
create table t1 (col int);
|
||||
insert into t1 values (-1), (-2), (-3);
|
||||
select bit_and(col), bit_or(col) from t1;
|
||||
bit_and(col) bit_or(col)
|
||||
18446744073709551612 18446744073709551615
|
||||
select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
|
||||
bit_and(col) bit_or(col)
|
||||
18446744073709551613 18446744073709551613
|
||||
18446744073709551614 18446744073709551614
|
||||
18446744073709551615 18446744073709551615
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
select avg(2) from t1;
|
||||
avg(2)
|
||||
NULL
|
||||
drop table t1;
|
||||
create table t1(
|
||||
a1 char(3) primary key,
|
||||
a2 smallint,
|
||||
@ -562,52 +624,6 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 range k2 k2 4 NULL 6 Using where; Using index
|
||||
1 SIMPLE t1 index NULL PRIMARY 3 NULL 14 Using index
|
||||
drop table t1, t2;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||
count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
insert into t1 values (1,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b) bit_xor(b)
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1 1
|
||||
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort
|
||||
Warnings:
|
||||
Note 1003 select high_priority big_result test.t1.a AS `a`,count(test.t1.b) AS `count(b)`,sum(test.t1.b) AS `sum(b)`,avg(test.t1.b) AS `avg(b)`,std(test.t1.b) AS `std(b)`,min(test.t1.b) AS `min(b)`,max(test.t1.b) AS `max(b)`,bit_and(test.t1.b) AS `bit_and(b)`,bit_or(test.t1.b) AS `bit_or(b)`,bit_xor(test.t1.b) AS `bit_xor(b)` from test.t1 group by test.t1.a
|
||||
drop table t1;
|
||||
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
|
||||
insert into t1 values (1, 3);
|
||||
select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
|
||||
@ -632,14 +648,3 @@ select a from t1 having a=1;
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (col int);
|
||||
insert into t1 values (-1), (-2), (-3);
|
||||
select bit_and(col), bit_or(col) from t1;
|
||||
bit_and(col) bit_or(col)
|
||||
18446744073709551612 18446744073709551615
|
||||
select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
|
||||
bit_and(col) bit_or(col)
|
||||
18446744073709551613 18446744073709551613
|
||||
18446744073709551614 18446744073709551614
|
||||
18446744073709551615 18446744073709551615
|
||||
drop table t1;
|
||||
|
@ -34,7 +34,7 @@ CREATE TABLE `t1` (
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES ("1234567890123456789012345678901234567890.00000000000000000000"),("0987654321098765432109876543210987654321.00000000000000000000");
|
||||
INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('0987654321098765432109876543210987654321.00000000000000000000');
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
|
||||
@ -68,6 +68,20 @@ UNLOCK TABLES;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
|
||||
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
||||
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
||||
INSERT INTO t1 VALUES ("1.2345", 2.3456);
|
||||
CREATE TABLE t1 (
|
||||
a decimal(10,5) default NULL,
|
||||
b float default NULL
|
||||
) TYPE=MyISAM;
|
||||
|
||||
INSERT INTO t1 VALUES ('1.23450',2.3456);
|
||||
INSERT INTO t1 VALUES ('1.23450',2.3456);
|
||||
INSERT INTO t1 VALUES ('1.23450',2.3456);
|
||||
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a int, b text, c varchar(3));
|
||||
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
|
||||
|
@ -134,6 +134,45 @@ select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 and 1=0 where t2.a1=
|
||||
select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Test of group function and NULL values
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (1,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #1972: test for bit_and(), bit_or() and negative values
|
||||
#
|
||||
create table t1 (col int);
|
||||
insert into t1 values (-1), (-2), (-3);
|
||||
select bit_and(col), bit_or(col) from t1;
|
||||
select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #3376: avg() and an empty table
|
||||
#
|
||||
|
||||
create table t1 (a int);
|
||||
select avg(2) from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Tests to check MIN/MAX query optimization
|
||||
#
|
||||
@ -327,30 +366,7 @@ explain
|
||||
select concat(min(t1.a1),min(t2.a4)) from t1, t2 where t2.a4 <> 'AME';
|
||||
drop table t1, t2;
|
||||
|
||||
#
|
||||
# Test of group function and NULL values
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
select count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1;
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (1,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
explain extended select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b), bit_xor(b) from t1 group by a;
|
||||
drop table t1;
|
||||
--disable_warnings
|
||||
create table t1 (USR_ID integer not null, MAX_REQ integer not null, constraint PK_SEA_USER primary key (USR_ID)) engine=InnoDB;
|
||||
--enable_warnings
|
||||
insert into t1 values (1, 3);
|
||||
select count(*) + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ + MAX_REQ - MAX_REQ from t1 group by MAX_REQ;
|
||||
select Case When Count(*) < MAX_REQ Then 1 Else 0 End from t1 where t1.USR_ID = 1 group by MAX_REQ;
|
||||
@ -369,11 +385,3 @@ insert into t1 values (1);
|
||||
select max(a) as b from t1 having b=1;
|
||||
select a from t1 having a=1;
|
||||
drop table t1;
|
||||
#
|
||||
# Bug #1972: test for bit_and(), bit_or() and negative values
|
||||
#
|
||||
create table t1 (col int);
|
||||
insert into t1 values (-1), (-2), (-3);
|
||||
select bit_and(col), bit_or(col) from t1;
|
||||
select SQL_BIG_RESULT bit_and(col), bit_or(col) from t1 group by col;
|
||||
drop table t1;
|
||||
|
@ -28,7 +28,30 @@ INSERT INTO t1 VALUES (-9e999999);
|
||||
# The following replaces is here because some systems replaces the above
|
||||
# double with '-inf' and others with MAX_DOUBLE
|
||||
--replace_result (-1.79769313486232e+308) (RES) (NULL) (RES)
|
||||
--exec $MYSQL_DUMP --skip-comments test t1
|
||||
--exec $MYSQL_DUMP --skip-comments test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #3361 mysqldum quotes DECIMAL values
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
|
||||
|
||||
# check at first how mysql work with quoted decimal
|
||||
|
||||
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
||||
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
||||
INSERT INTO t1 VALUES ("1.2345", 2.3456);
|
||||
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
|
||||
INSERT INTO t1 VALUES (1.2345, 2.3456);
|
||||
INSERT INTO t1 VALUES ('1.2345', 2.3456);
|
||||
--error 1054
|
||||
INSERT INTO t1 VALUES ("1.2345", 2.3456);
|
||||
SET SQL_MODE=@OLD_SQL_MODE;
|
||||
|
||||
# check how mysqldump make quoting
|
||||
--exec $MYSQL_DUMP --skip-comments test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(a int, b text, c varchar(3));
|
||||
|
Reference in New Issue
Block a user