config root man

Current Path : /home/usr.opt/mysql57/mysql-test/r/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : /home/usr.opt/mysql57/mysql-test/r/func_analyse.result

drop table if exists t1,t2;
create table t1 (i int, j int, empty_string char(10), bool char(1), d date);
insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05");
select count(*) from t1 procedure analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
count(*)	4	4	1	1	0	0	4.0000	0.0000	ENUM('4') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
select * from t1 procedure analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.i	1	7	1	1	0	0	4.0000	2.2361	ENUM('1','3','5','7') NOT NULL
test.t1.j	2	8	1	1	0	0	5.0000	2.2361	ENUM('2','4','6','8') NOT NULL
test.t1.empty_string			0	0	4	0	0.0000	NULL	CHAR(0) NOT NULL
test.t1.bool	N	Y	1	1	0	0	1.0000	NULL	ENUM('N','Y') NOT NULL
test.t1.d	2002-03-03	2002-03-05	10	10	0	0	10.0000	NULL	ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
select * from t1 procedure analyse(2);
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.i	1	7	1	1	0	0	4.0000	2.2361	TINYINT(1) UNSIGNED NOT NULL
test.t1.j	2	8	1	1	0	0	5.0000	2.2361	TINYINT(1) UNSIGNED NOT NULL
test.t1.empty_string			0	0	4	0	0.0000	NULL	CHAR(0) NOT NULL
test.t1.bool	N	Y	1	1	0	0	1.0000	NULL	ENUM('N','Y') NOT NULL
test.t1.d	2002-03-03	2002-03-05	10	10	0	0	10.0000	NULL	ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
create table t2 select * from t1 procedure analyse();
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
drop table t1;
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
1	1	1	1	1	0	0	1.0000	0.0000	ENUM('1') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	PRIMARY	<derived2>	NULL	system	NULL	NULL	NULL	NULL	1	100.00	NULL
2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
Note	1003	/* select#1 */ select 1 AS `1` from dual
EXPLAIN SELECT 1 FROM (SELECT 1) a;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	PRIMARY	<derived2>	NULL	system	NULL	NULL	NULL	NULL	1	100.00	NULL
2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
Warnings:
Note	1003	/* select#1 */ select 1 AS `1` from dual
create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.v	"	\\	1	19	0	0	3.7619	NULL	ENUM('"','""','"c','\'\0\\"','\'','\'\'','\'b','a\0\0\0b','a\0','a""""b','a\'\'\'\'b','abc','abc\'def\\hij"klm\0opq','a\\\\\\\\b','b\'','c"','d\\','The\ZEnd','\\','\\d','\\\\') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 procedure analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.df	1.1	2.2	13	13	0	0	1.65000	0.55000	ENUM('1.1','2.2') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
drop table t1;
create table t1 (d double);
insert into t1 values (100000);
select * from t1 procedure analyse (1,1);
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.d	100000	100000	6	6	0	0	100000	0	MEDIUMINT(6) UNSIGNED NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
drop table t1;
create table t1 (product varchar(32), country_id int not null, year int,
profit int);
insert into t1  values ( 'Computer', 2,2000, 1200),
( 'TV', 1, 1999, 150),
( 'Calculator', 1, 1999,50),
( 'Computer', 1, 1999,1500),
( 'Computer', 1, 2000,1500),
( 'TV', 1, 2000, 150),
( 'TV', 2, 2000, 100),
( 'TV', 2, 2000, 100),
( 'Calculator', 1, 2000,75),
( 'Calculator', 2, 2000,75),
( 'TV', 1, 1999, 100),
( 'Computer', 1, 1999,1200),
( 'Computer', 2, 2000,1500),
( 'Calculator', 2, 2000,75),
( 'Phone', 3, 2003,10)
;
create table t2 (country_id int primary key, country char(20) not null);
insert into t2 values (1, 'USA'),(2,'India'), (3,'Finland');
select product, sum(profit),avg(profit) from t1 group by product with rollup;
product	sum(profit)	avg(profit)
Calculator	275	68.7500
Computer	6900	1380.0000
Phone	10	10.0000
TV	600	120.0000
NULL	7785	519.0000
select product, sum(profit),avg(profit) from t1 group by product with rollup procedure analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.product	Calculator	TV	2	10	0	0	5.4000	NULL	ENUM('Calculator','Computer','Phone','TV') NOT NULL
sum(profit)	10	6900	11	11	0	0	1677.0000	2620.8426	ENUM('10','275','600','6900') NOT NULL
avg(profit)	10.0000	1380.0000	16	16	0	0	339.75000000	521.70417863	ENUM('10.0000','68.7500','120.0000','1380.0000') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
drop table t1,t2;
create table t1 (f1 double(10,5), f2 char(10), f3 double(10,5));
insert into t1 values (5.999, "5.9999", 5.99999), (9.555, "9.5555", 9.55555);
select f1 from t1 procedure analyse(1, 1);
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.f1	5.99900	9.55500	7	7	0	0	7.77700	1.77800	FLOAT(4,3) NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
select f2 from t1 procedure analyse(1, 1);
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.f2	5.9999	9.5555	6	6	0	0	6.0000	NULL	FLOAT(5,4) UNSIGNED NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
select f3 from t1 procedure analyse(1, 1);
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.f3	5.99999	9.55555	7	7	0	0	7.77777	1.77778	FLOAT(6,5) NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
drop table t1;
set @optimizer_switch_saved=@@session.optimizer_switch;
set optimizer_switch='derived_merge=off';
CREATE TABLE t1(a INT,b INT,c INT,d INT,e INT,f INT,g INT,h INT,i INT,j INT,k INT);
INSERT INTO t1 VALUES ();
SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
d.a	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.b	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.c	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.d	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.e	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.f	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.g	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.h	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.i	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.j	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
d.k	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
DROP TABLE t1;
set @@session.optimizer_switch=@optimizer_switch_saved;
End of 4.1 tests
#
# Bug #48293: crash with procedure analyse, view with > 10 columns, 
#  having clause...
#
CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
f INT, g INT, h INT, i INT, j INT,k INT);
INSERT INTO t1 VALUES (),();
ANALYZE TABLE t1;
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
#should have a derived table
EXPLAIN SELECT * FROM v1;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	PRIMARY	<derived2>	NULL	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
2	DERIVED	t1	NULL	ALL	NULL	NULL	NULL	NULL	2	100.00	NULL
Warnings:
Note	1003	/* select#1 */ select `v1`.`a` AS `a`,`v1`.`b` AS `b`,`v1`.`c` AS `c`,`v1`.`d` AS `d`,`v1`.`e` AS `e`,`v1`.`f` AS `f`,`v1`.`g` AS `g`,`v1`.`h` AS `h`,`v1`.`i` AS `i`,`v1`.`j` AS `j`,`v1`.`k` AS `k` from `test`.`v1`
#should not crash
SELECT * FROM v1 PROCEDURE analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
v1.a	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.b	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.c	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.d	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.e	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.f	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.g	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.h	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.i	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.j	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
v1.k	NULL	NULL	0	0	0	2	0.0	0.0	CHAR(0)
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
#should not crash
SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.a.a	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.b	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.c	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.d	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.e	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.f	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.g	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.h	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.i	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.j	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.a.k	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.a	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.b	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.c	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.d	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.e	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.f	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.g	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.h	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.i	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.j	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
v1.k	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.a	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.b	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.c	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.d	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.e	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.f	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.g	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.h	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.i	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.j	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
test.b.k	NULL	NULL	0	0	0	8	0.0	0.0	CHAR(0)
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
#should not crash
SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
#should not crash
SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
#should not crash
SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
DROP VIEW v1;
DROP TABLE t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1),(2);
# should not crash
CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
DROP TABLE t1;
End of 5.0 tests
#
# Bug#11765202: Dbug_violation_helper::~Dbug_violation_helper(): Assertion `!_entered' failed.
#
DROP TABLE IF EXISTS t1;
Warnings:
Note	1051	Unknown table 'test.t1'
CREATE TABLE t1 (a VARCHAR(2) CHARSET UTF8 NOT NULL);
INSERT INTO t1 VALUES ('e'),('e'),('e-');
SELECT * FROM t1 PROCEDURE ANALYSE();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.a	e	e-	1	2	0	0	1.3333	NULL	ENUM('e','e-') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
DROP TABLE t1;
#
# Bug#11756242  48137: PROCEDURE ANALYSE() LEAKS MEMORY WHEN RETURNING NULL
#
CREATE TABLE t1(f1 INT) ENGINE=MYISAM;
CREATE TABLE t2(f2 INT) ENGINE=INNODB;
INSERT INTO t2 VALUES (1);
SELECT DISTINCTROW f1 FROM t1 NATURAL RIGHT OUTER JOIN t2 PROCEDURE ANALYSE();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.f1	NULL	NULL	0	0	0	1	0.0	0.0	CHAR(0)
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
SELECT * FROM t2 LIMIT 1 PROCEDURE ANALYSE();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t2.f2	1	1	1	1	0	0	1.0000	0.0000	ENUM('1') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
DROP TABLE t1, t2;
End of 5.1 tests
#
# Bug #47338 assertion in handler::ha_external_lock
#
drop table if exists t1;
CREATE TEMPORARY TABLE t1 (f2 INT, f1 INT, PRIMARY KEY (f1)) ENGINE = MyISAM;
INSERT t1 ( f1 ) VALUES ( 5 );
INSERT t1 ( f1 ) VALUES ( 6 );
ALTER TABLE t1 ENGINE = MyISAM;
ANALYZE TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	OK
SELECT f1,f2 FROM t1 A WHERE f1 BETWEEN 0 AND 1;
f1	f2
drop table t1;
#
# Bug #13358379   EXPLAIN SELECT ... PROCEDURE ANALYZE CRASHES THE SERVER
#
CREATE TABLE t1 (i INT);
EXPLAIN SELECT * FROM t1 PROCEDURE ANALYSE();
DROP TABLE t1;
#
# WL#6242: Move "PROCEDURE ANALYSE" implementation
#          to select_send-like class
#
# Coverage tests
#

SET sql_mode = 'NO_ENGINE_SUBSTITUTION';
Warnings:
Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
CREATE TABLE t1 (a INT);
# Trivial query:
SELECT * FROM t1 PROCEDURE ANALYSE();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
# PROCEDURE ANALYSE in PS:
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
PREPARE stmt1 FROM "SELECT * FROM t1 PROCEDURE ANALYSE()";
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
EXECUTE stmt1;
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.a	1	5	1	1	0	0	3.0000	1.4142	ENUM('1','2','3','4','5') NOT NULL
EXECUTE stmt1;
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.a	1	5	1	1	0	0	3.0000	1.4142	ENUM('1','2','3','4','5') NOT NULL
EXECUTE stmt1;
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.a	1	5	1	1	0	0	3.0000	1.4142	ENUM('1','2','3','4','5') NOT NULL
DEALLOCATE PREPARE stmt1;
# PROCEDURE ANALYSE in SP:
CREATE PROCEDURE p1()
BEGIN
SELECT * FROM t1 PROCEDURE ANALYSE();
END;|
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
CALL p1();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t1.a	1	5	1	1	0	0	3.0000	1.4142	ENUM('1','2','3','4','5') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
DROP PROCEDURE p1;
# PROCEDURE ANALYSE in SP cursor:
CREATE PROCEDURE p1()
BEGIN
DECLARE c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 CHAR(20);
DECLARE done INT DEFAULT 0;
DECLARE cur1 CURSOR FOR SELECT * FROM t1 PROCEDURE ANALYSE();
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
OPEN cur1;
read_loop: LOOP
FETCH cur1 INTO c1, c2, c3, c4, c5, c6, c7, c8, c9, c10;
IF done THEN
LEAVE read_loop;
END IF;
END LOOP;
CLOSE cur1;
END;|
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
CALL p1();
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
DROP PROCEDURE p1;
# EXPLAIN with or wihtout PROCEDURE ANALYSE should be same:
ANALYZE TABLE t1;
EXPLAIN SELECT * FROM t1, (SELECT * FROM t1) tt1 WHERE t1.a = tt1.a;
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	NULL	ALL	NULL	NULL	NULL	NULL	5	100.00	NULL
1	SIMPLE	t1	NULL	ALL	NULL	NULL	NULL	NULL	5	20.00	Using where; Using join buffer (Block Nested Loop)
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t1`.`a`)
EXPLAIN SELECT * FROM t1, (SELECT * FROM t1) tt1 WHERE t1.a = tt1.a PROCEDURE ANALYSE();
id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	NULL	ALL	NULL	NULL	NULL	NULL	5	100.00	NULL
1	SIMPLE	t1	NULL	ALL	NULL	NULL	NULL	NULL	5	20.00	Using where; Using join buffer (Block Nested Loop)
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
Note	1003	/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`a` AS `a` from `test`.`t1` join `test`.`t1` where (`test`.`t1`.`a` = `test`.`t1`.`a`)
CREATE TABLE t2 (i INT, j INT);
# PROCEDURE ANALYSE ignores ROLLUP rows:
INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
SELECT i, AVG(j) FROM t2 GROUP BY i WITH ROLLUP;
i	AVG(j)
1	1.0000
2	2.0000
3	3.0000
4	4.0000
NULL	2.5000
SELECT i, AVG(j) FROM t2 GROUP BY i WITH ROLLUP PROCEDURE ANALYSE();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t2.i	1	4	1	1	0	0	2.8000	1.1662	ENUM('1','2','3','4') NOT NULL
AVG(j)	1.0000	4.0000	16	16	0	0	2.80000000	1.16619038	ENUM('1.0000','2.0000','3.0000','4.0000') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
SELECT i, AVG(j) FROM t2 GROUP BY i PROCEDURE ANALYSE();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t2.i	1	4	1	1	0	0	2.5000	1.1180	ENUM('1','2','3','4') NOT NULL
AVG(j)	1.0000	4.0000	16	16	0	0	2.50000000	1.11803399	ENUM('1.0000','2.0000','3.0000','4.0000') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
# LIMIT affects original SELECT output, not PROCEDURE ANALYSE output:
SELECT * FROM t2 LIMIT 1 PROCEDURE ANALYSE();
Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
test.t2.i	1	1	1	1	0	0	1.0000	0.0000	ENUM('1') NOT NULL
test.t2.j	1	1	1	1	0	0	1.0000	0.0000	ENUM('1') NOT NULL
Warnings:
Warning	1681	'PROCEDURE ANALYSE' is deprecated and will be removed in a future release.
# Wrong usage: CREATE TABLE/VIEW and INSERT from SELECT:
CREATE TABLE t SELECT * FROM t1 PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
CREATE VIEW v AS SELECT * FROM t1 PROCEDURE ANALYSE();
ERROR HY000: View's SELECT contains a 'PROCEDURE' clause
INSERT INTO t1 SELECT * FROM t1 PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
# Wrong usage: subquery with PROCEDURE ANALYSE():
SELECT (SELECT * FROM t1 PROCEDURE ANALYSE());
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT (SELECT * FROM t1 PROCEDURE ANALYSE()) PROCEDURE ANALYSE;
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT * FROM (SELECT * FROM t1 PROCEDURE ANALYSE()) tt1;
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT * FROM t1 WHERE a IN (SELECT * FROM t1 PROCEDURE ANALYSE());
ERROR HY000: Incorrect usage of PROCEDURE and subquery
# Wrong usage: SELECT ... INTO
SELECT i INTO @a FROM t1 LIMIT 1 PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and INTO
SELECT * INTO OUTFILE "MYSQLTEST_VARDIR/wl6242.outfile" FROM t1 PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and INTO
SELECT * INTO DUMPFILE "MYSQLTEST_VARDIR/wl6242.dumpfile" FROM t1 PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and INTO
# Wrong usage: UNION:
SELECT * FROM t1 UNION SELECT * FROM t1 PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and subquery
SELECT * FROM t1 PROCEDURE ANALYSE() UNION SELECT * FROM t1;
ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE()
# Wrong 1st parameter:
SELECT * FROM t1 PROCEDURE ANALYSE((SELECT 1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT 1))' at line 1
SELECT * FROM t1 PROCEDURE ANALYSE('test');
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test')' at line 1
SELECT * FROM t1 PROCEDURE ANALYSE(-100);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-100)' at line 1
SELECT * FROM t1 PROCEDURE ANALYSE(3.1415);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3.1415)' at line 1
# Wrong 2nd parameter:
SELECT * FROM t1 PROCEDURE ANALYSE(100, (SELECT 1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(SELECT 1))' at line 1
SELECT * FROM t1 PROCEDURE ANALYSE(100, 'test');
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test')' at line 1
SELECT * FROM t1 PROCEDURE ANALYSE(100, -100);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-100)' at line 1
SELECT * FROM t1 PROCEDURE ANALYSE(100, 3.1415);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '3.1415)' at line 1
# Wrong parameter count:
SELECT * FROM t1 PROCEDURE ANALYSE(100, 200, 300);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 300)' at line 1
DROP TABLE t1, t2;
SET sql_mode = default;
# End of 5.6 tests

Man Man