summaryrefslogtreecommitdiff
path: root/mysql-test/r/analyse.result
diff options
context:
space:
mode:
authorGeorgi Kodinov <joro@sun.com>2009-10-30 11:40:44 +0200
committerGeorgi Kodinov <joro@sun.com>2009-10-30 11:40:44 +0200
commit851e250953e531c2c5189dff0d7202cb79acf5d6 (patch)
tree8e5e5c8044149eb2d6c1ffe30c379a3322a59782 /mysql-test/r/analyse.result
parentac37324843b97fc69c307f8bab52af69c81c1245 (diff)
downloadmariadb-git-851e250953e531c2c5189dff0d7202cb79acf5d6.tar.gz
Bug #48293: crash with procedure analyse, view with > 10 columns,
having clause... The fix for bug 46184 was not very complete. It was not covering views using temporary tables and multiple tables in a FROM clause. Fixed by reverting the fix for 46184 and making a more general check that is checking at the right execution stage and for all of the non-supported cases. Now PROCEDURE ANALYZE on non-top level SELECT is also forbidden. Updated the analyse.test and subselect.test accordingly.
Diffstat (limited to 'mysql-test/r/analyse.result')
-rw-r--r--mysql-test/r/analyse.result112
1 files changed, 39 insertions, 73 deletions
diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result
index 1e3a2985f74..1820782d2f8 100644
--- a/mysql-test/r/analyse.result
+++ b/mysql-test/r/analyse.result
@@ -19,81 +19,10 @@ 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
create table t2 select * from t1 procedure analyse();
-select * from t2;
-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
-drop table t1,t2;
+ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
+drop table t1;
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and subquery
-create table t1 (a int not null);
-create table t2 select * from t1 where 0=1 procedure analyse();
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `Field_name` varbinary(255) NOT NULL default '',
- `Min_value` varbinary(255) default NULL,
- `Max_value` varbinary(255) default NULL,
- `Min_length` bigint(11) NOT NULL default '0',
- `Max_length` bigint(11) NOT NULL default '0',
- `Empties_or_zeros` bigint(11) NOT NULL default '0',
- `Nulls` bigint(11) NOT NULL default '0',
- `Avg_value_or_avg_length` varbinary(255) NOT NULL default '',
- `Std` varbinary(255) default NULL,
- `Optimal_fieldtype` varbinary(64) NOT NULL default ''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-select * from t1 where 0=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
-insert into t1 values(1);
-drop table t2;
-create table t2 select * from t1 where 0=1 procedure analyse();
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `Field_name` varbinary(255) NOT NULL default '',
- `Min_value` varbinary(255) default NULL,
- `Max_value` varbinary(255) default NULL,
- `Min_length` bigint(11) NOT NULL default '0',
- `Max_length` bigint(11) NOT NULL default '0',
- `Empties_or_zeros` bigint(11) NOT NULL default '0',
- `Nulls` bigint(11) NOT NULL default '0',
- `Avg_value_or_avg_length` varbinary(255) NOT NULL default '',
- `Std` varbinary(255) default NULL,
- `Optimal_fieldtype` varbinary(64) NOT NULL default ''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-select * from t2;
-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-insert into t2 select * from t1 procedure analyse();
-select * from t2;
-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 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
-insert into t1 values(2);
-drop table t2;
-create table t2 select * from t1 where 0=1 procedure analyse();
-show create table t2;
-Table Create Table
-t2 CREATE TABLE `t2` (
- `Field_name` varbinary(255) NOT NULL default '',
- `Min_value` varbinary(255) default NULL,
- `Max_value` varbinary(255) default NULL,
- `Min_length` bigint(11) NOT NULL default '0',
- `Max_length` bigint(11) NOT NULL default '0',
- `Empties_or_zeros` bigint(11) NOT NULL default '0',
- `Nulls` bigint(11) NOT NULL default '0',
- `Avg_value_or_avg_length` varbinary(255) NOT NULL default '',
- `Std` varbinary(255) default NULL,
- `Optimal_fieldtype` varbinary(64) NOT NULL default ''
-) ENGINE=MyISAM DEFAULT CHARSET=latin1
-select * from t2;
-Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
-insert into t2 select * from t1 procedure analyse();
-select * from t2;
-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 2 1 1 0 0 1.5000 0.5000 ENUM('1','2') NOT NULL
-drop table t1,t2;
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();
@@ -157,3 +86,40 @@ SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
ERROR HY000: Incorrect usage of PROCEDURE and subquery
DROP TABLE t1;
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 (),();
+CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
+#should have a derived table
+EXPLAIN SELECT * FROM v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
+2 DERIVED t1 ALL NULL NULL NULL NULL 2
+#should not crash
+SELECT * FROM v1 PROCEDURE analyse();
+ERROR HY000: Incorrect usage of PROCEDURE and view
+#should not crash
+SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
+ERROR HY000: Incorrect usage of PROCEDURE and view
+#should not crash
+SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
+ERROR HY000: Incorrect usage of PROCEDURE and subquery
+#should not crash
+SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
+ERROR HY000: Incorrect usage of PROCEDURE and subquery
+#should not crash
+SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
+ERROR HY000: Can't use ORDER clause with this procedure
+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