mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
f537319d42
A lot of new tests to mysqltest Fixed bug with BDB tables and autocommit BitKeeper/deleted/.del-delete.test~389410e29f2cebe5: Delete: mysql-test/t/delete.test BitKeeper/deleted/.del-delete.result~e866a6678e29f186: Delete: mysql-test/r/delete.result BitKeeper/deleted/.del-sel000014.test~74cb8c70f1d73fcc: Delete: mysql-test/t/sel000014.test BitKeeper/deleted/.del-sel000015.test~7442bf9cbc96fe07: Delete: mysql-test/t/sel000015.test BitKeeper/deleted/.del-sel000016.test~f495235f14c47ec: Delete: mysql-test/t/sel000016.test BitKeeper/deleted/.del-sel000017.test~7c39f2b45a6aa780: Delete: mysql-test/t/sel000017.test BitKeeper/deleted/.del-sel000018.test~16207f3ad74de75e: Delete: mysql-test/t/sel000018.test BitKeeper/deleted/.del-sel000014.result~fc8de0ec89d9e35: Delete: mysql-test/r/sel000014.result BitKeeper/deleted/.del-sel000015.result~cadbc52051d47bac: Delete: mysql-test/r/sel000015.result BitKeeper/deleted/.del-sel000016.result~6177851869bd5b07: Delete: mysql-test/r/sel000016.result BitKeeper/deleted/.del-sel000017.result~84ebf147850ff31c: Delete: mysql-test/r/sel000017.result BitKeeper/deleted/.del-sel000018.result~562ac9094cf53aba: Delete: mysql-test/r/sel000018.result BitKeeper/deleted/.del-sel000005.test~982fde89a4d6d886: Delete: mysql-test/t/sel000005.test BitKeeper/deleted/.del-sel000006.test~291cc6c8d85e51df: Delete: mysql-test/t/sel000006.test BitKeeper/deleted/.del-sel000005.result~d5410bb765199cc5: Delete: mysql-test/r/sel000005.result BitKeeper/deleted/.del-sel000006.result~d38004d1acfc11a5: Delete: mysql-test/r/sel000006.result BitKeeper/deleted/.del-sel000004.test~daf9ad4a1a31cd3c: Delete: mysql-test/t/sel000004.test BitKeeper/deleted/.del-sel000007.test~f431e4f4739a24c3: Delete: mysql-test/t/sel000007.test BitKeeper/deleted/.del-sel000008.test~b338ef585cadf7ae: Delete: mysql-test/t/sel000008.test BitKeeper/deleted/.del-sel000009.test~a455c38f5c942cd1: Delete: mysql-test/t/sel000009.test BitKeeper/deleted/.del-sel000010.test~ca07085ae92255f1: Delete: mysql-test/t/sel000010.test BitKeeper/deleted/.del-sel000011.test~c2a971726c9d18d6: Delete: mysql-test/t/sel000011.test BitKeeper/deleted/.del-sel000012.test~ae64bff363c42e92: Delete: mysql-test/t/sel000012.test BitKeeper/deleted/.del-sel000013.test~ce8aa504ba4f74ba: Delete: mysql-test/t/sel000013.test BitKeeper/deleted/.del-sel000019.test~8fd63c8dc6be8dbc: Delete: mysql-test/t/sel000019.test BitKeeper/deleted/.del-sel000020.test~c5758ad18a6dff1e: Delete: mysql-test/t/sel000020.test BitKeeper/deleted/.del-sel000021.test~94dd47de2872264a: Delete: mysql-test/t/sel000021.test BitKeeper/deleted/.del-sel000022.test~6e3e5435e66875e9: Delete: mysql-test/t/sel000022.test BitKeeper/deleted/.del-sel000023.test~7bdfcfaa278f837d: Delete: mysql-test/t/sel000023.test BitKeeper/deleted/.del-sel000024.test~849f47e6cbdc4fe3: Delete: mysql-test/t/sel000024.test BitKeeper/deleted/.del-sel000025.test~65b32b4b67e4c77: Delete: mysql-test/t/sel000025.test BitKeeper/deleted/.del-sel000026.test~d8aa2d614f23b1: Delete: mysql-test/t/sel000026.test BitKeeper/deleted/.del-sel000027.test~ab44bb57a580de9: Delete: mysql-test/t/sel000027.test BitKeeper/deleted/.del-sel000028.test~db9bfc0a808fb629: Delete: mysql-test/t/sel000028.test BitKeeper/deleted/.del-sel000029.test~6aae34dbb3ee86d9: Delete: mysql-test/t/sel000029.test BitKeeper/deleted/.del-sel000030.test~a29683eac3e7b706: Delete: mysql-test/t/sel000030.test BitKeeper/deleted/.del-sel000004.result~1f8d1265be521c17: Delete: mysql-test/r/sel000004.result BitKeeper/deleted/.del-sel000007.result~df455e49f9727c4f: Delete: mysql-test/r/sel000007.result BitKeeper/deleted/.del-sel000008.result~67a459ff62c84d6a: Delete: mysql-test/r/sel000008.result BitKeeper/deleted/.del-sel000009.result~e042b35ab131fb3: Delete: mysql-test/r/sel000009.result BitKeeper/deleted/.del-sel000010.result~eee5b9631a1e0066: Delete: mysql-test/r/sel000010.result BitKeeper/deleted/.del-sel000011.result~6907fe356973ed25: Delete: mysql-test/r/sel000011.result BitKeeper/deleted/.del-sel000012.result~be18991fc28954c2: Delete: mysql-test/r/sel000012.result BitKeeper/deleted/.del-sel000013.result~513389e06c96af73: Delete: mysql-test/r/sel000013.result BitKeeper/deleted/.del-sel000019.result~2870fe1c4998d929: Delete: mysql-test/r/sel000019.result BitKeeper/deleted/.del-sel000020.result~faa670294ef5fa91: Delete: mysql-test/r/sel000020.result BitKeeper/deleted/.del-sel000021.result~8f0ce4ec26e0c21d: Delete: mysql-test/r/sel000021.result BitKeeper/deleted/.del-sel000022.result~34828a43753ee767: Delete: mysql-test/r/sel000022.result BitKeeper/deleted/.del-sel000023.result~13e112d77573bf17: Delete: mysql-test/r/sel000023.result BitKeeper/deleted/.del-sel000024.result~b10d449624f48d07: Delete: mysql-test/r/sel000024.result BitKeeper/deleted/.del-sel000025.result~f31e08fcca805f35: Delete: mysql-test/r/sel000025.result BitKeeper/deleted/.del-sel000026.result~854fa951666b7982: Delete: mysql-test/r/sel000026.result BitKeeper/deleted/.del-sel000027.result~cfd73fe738f27da: Delete: mysql-test/r/sel000027.result BitKeeper/deleted/.del-sel000028.result~13ff5add6ac24908: Delete: mysql-test/r/sel000028.result BitKeeper/deleted/.del-sel000029.result~c6d071781808aa26: Delete: mysql-test/r/sel000029.result BitKeeper/deleted/.del-sel000030.result~98d496948e15064d: Delete: mysql-test/r/sel000030.result BitKeeper/deleted/.del-alt000001.test~633aed61c4bad94c: Delete: mysql-test/t/alt000001.test BitKeeper/deleted/.del-alt000001.result~393103dbf15f35c9: Delete: mysql-test/r/alt000001.result BitKeeper/deleted/.del-mrg000001.dummy.result~bf7e6d609f22b897: Delete: mysql-test/r/mrg000001.dummy.result BitKeeper/deleted/.del-mrg000001.result~db2ef2e717ab8332: Delete: mysql-test/r/mrg000001.result BitKeeper/deleted/.del-mrg000002.result~745be0854aaaaf5e: Delete: mysql-test/r/mrg000002.result BitKeeper/deleted/.del-mrg000001.test~e0327f9d1e6cb4e: Delete: mysql-test/t/mrg000001.test BitKeeper/deleted/.del-mrg000002.test~16b3a176adc0f311: Delete: mysql-test/t/mrg000002.test Docs/manual.texi: Changelog client/mysqlimport.c: Added support for hex strings client/mysqltest.c: Added linenumbers in output Only allow '{' first on a row (Conflicts with ODBC {} syntax). Handle bigger queries. Handle double '' Truncate result files. mysql-test/mysql-test-run.sh: Added --verbose cleanup mysql-test/r/bdb.result: Updating of test mysql-test/r/func_crypt.result: Updating of test mysql-test/r/func_equal.result: Updating of test mysql-test/r/func_str.result: Updating of test mysql-test/r/ins000001.result: Updating of test mysql-test/t/bdb.test: Updating of test mysql-test/t/err000001.test: Updating of test mysql-test/t/func_crypt.test: Updating of test mysql-test/t/func_equal.test: Updating of test mysql-test/t/func_str.test: Updating of test mysql-test/t/ins000001.test: Updating of test sql/gen_lex_hash.cc: Smaller table sql/handler.cc: Fixed bug in auto_commit
100 lines
3.2 KiB
Text
100 lines
3.2 KiB
Text
#
|
|
# simple test of all group functions
|
|
#
|
|
|
|
create table t1 (grp int, a bigint unsigned, c char(10) not null);
|
|
insert into t1 values (1,1,"a");
|
|
insert into t1 values (2,2,"b");
|
|
insert into t1 values (2,3,"c");
|
|
insert into t1 values (3,4,"E");
|
|
insert into t1 values (3,5,"C");
|
|
insert into t1 values (3,6,"D");
|
|
|
|
# Test of MySQL field extension with and without matching records.
|
|
select a,c,sum(a) from t1 group by a;
|
|
select a,c,sum(a) from t1 where a > 10 group by a;
|
|
select sum(a) from t1 where a > 10;
|
|
select a from t1 order by rand(10);
|
|
select distinct a from t1 order by rand(10);
|
|
select count(distinct a),count(distinct grp) from t1;
|
|
insert into t1 values (null,null,'');
|
|
select count(distinct a),count(distinct grp) from t1;
|
|
|
|
select sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1;
|
|
select grp, sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
|
|
select grp, sum(a)+count(a)+avg(a)+std(a)+bit_or(a)+bit_and(a)+min(a)+max(a)+min(c)+max(c) as sum from t1 group by grp;
|
|
|
|
create table t2 (grp int, a bigint unsigned, c char(10));
|
|
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
|
|
replace into t2 select grp, a, c from t1 limit 2,1;
|
|
select * from t2;
|
|
|
|
drop table t1,t2;
|
|
|
|
#
|
|
# Problem with std()
|
|
#
|
|
|
|
CREATE TABLE t1 (id int(11),value1 float(10,2));
|
|
INSERT INTO t1 VALUES (1,0.00),(1,1.00), (1,2.00), (2,10.00), (2,11.00), (2,12.00);
|
|
CREATE TABLE t2 (id int(11),name char(20));
|
|
INSERT INTO t2 VALUES (1,'Set One'),(2,'Set Two');
|
|
select id, avg(value1), std(value1) from t1 group by id;
|
|
select name, avg(value1), std(value1) from t1, t2 where t1.id = t2.id group by t1.id;
|
|
drop table t1,t2;
|
|
|
|
#
|
|
# Test of bug in left join & avg
|
|
#
|
|
|
|
create table t1 (id int not null);
|
|
create table t2 (id int not null,rating int null);
|
|
insert into t1 values(1),(2),(3);
|
|
insert into t2 values(1, 3),(2, NULL),(2, NULL),(3, 2),(3, NULL);
|
|
select t1.id, avg(rating) from t1 left join t2 on ( t1.id = t2.id ) group by t1.id;
|
|
drop table t1,t2;
|
|
|
|
#
|
|
# test of count
|
|
#
|
|
create table t1 (a smallint(6) primary key, c char(10), b text);
|
|
INSERT INTO t1 VALUES (1,'1','1');
|
|
INSERT INTO t1 VALUES (2,'2','2');
|
|
INSERT INTO t1 VALUES (4,'4','4');
|
|
|
|
select count(*) from t1;
|
|
select count(*) from t1 where a = 1;
|
|
select count(*) from t1 where a = 100;
|
|
select count(*) from t1 where a >= 10;
|
|
select count(a) from t1 where a = 1;
|
|
select count(a) from t1 where a = 100;
|
|
select count(a) from t1 where a >= 10;
|
|
select count(b) from t1 where b >= 2;
|
|
select count(b) from t1 where b >= 10;
|
|
select count(c) from t1 where c = 10;
|
|
drop table t1;
|
|
|
|
#
|
|
# Test of bug in COUNT(i)*(i+0)
|
|
#
|
|
|
|
CREATE TABLE t1 (d DATETIME, i INT);
|
|
INSERT INTO t1 VALUES (NOW(), 1);
|
|
SELECT COUNT(i), i, COUNT(i)*i FROM t1 GROUP BY i;
|
|
SELECT COUNT(i), (i+0), COUNT(i)*(i+0) FROM t1 GROUP BY i;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Another SUM() problem with 3.23.2
|
|
#
|
|
|
|
create table t1 (
|
|
num float(5,2),
|
|
user char(20)
|
|
);
|
|
insert into t1 values (10.3,'nem'),(20.53,'monty'),(30.23,'sinisa');
|
|
insert into t1 values (30.13,'nem'),(20.98,'monty'),(10.45,'sinisa');
|
|
insert into t1 values (5.2,'nem'),(8.64,'monty'),(11.12,'sinisa');
|
|
select sum(num) from t1;
|
|
select sum(num) from t1 group by user;
|
|
drop table t1;
|