mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge from mysql-5.1-bugteam
This commit is contained in:
@ -324,3 +324,21 @@ insert into t1 values(null,0,0,0,null);
|
||||
replace into t1 values(null,1,0,2,null);
|
||||
select last_insert_id();
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#46616: Assertion `!table->auto_increment_field_not_null' on view
|
||||
--echo # manipulations
|
||||
--echo #
|
||||
CREATE TABLE t1 ( a INT );
|
||||
INSERT INTO t1 VALUES (1), (1);
|
||||
|
||||
CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
|
||||
--error ER_DUP_ENTRY
|
||||
CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1;
|
||||
|
||||
UPDATE t2 SET a = 2;
|
||||
|
||||
SELECT a FROM t2;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
|
@ -19,3 +19,22 @@ let $other_engine_type= MEMORY;
|
||||
let $other_handler_engine_type= MyISAM;
|
||||
|
||||
--source include/handler.inc
|
||||
|
||||
--echo #
|
||||
--echo # BUG #46456: HANDLER OPEN + TRUNCATE + DROP (temporary) TABLE, crash
|
||||
--echo #
|
||||
CREATE TABLE t1 AS SELECT 1 AS f1;
|
||||
HANDLER t1 OPEN;
|
||||
TRUNCATE t1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
HANDLER t1 READ FIRST;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TEMPORARY TABLE t1 AS SELECT 1 AS f1;
|
||||
HANDLER t1 OPEN;
|
||||
TRUNCATE t1;
|
||||
--error ER_UNKNOWN_TABLE
|
||||
HANDLER t1 READ FIRST;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -1622,4 +1622,15 @@ DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SELECT 1 FROM m1; # Should not hang!
|
||||
|
||||
--echo #
|
||||
--echo # Bug #46614: Assertion in show_create_trigger()
|
||||
--echo #
|
||||
CREATE TABLE t1(a int);
|
||||
CREATE TABLE t2(a int);
|
||||
CREATE TABLE t3(a int) ENGINE = MERGE UNION(t1, t2);
|
||||
CREATE TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo();
|
||||
SHOW CREATE TRIGGER tr1;
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -1,12 +1,35 @@
|
||||
--disable_abort_on_error
|
||||
# Run this tets only when mysqld don't has partitioning
|
||||
# Run this test only when mysqld don't has partitioning (not compiled with)
|
||||
# the statements are not expected to work, just check that we
|
||||
# can't crash the server
|
||||
-- require r/not_partition.require
|
||||
disable_query_log;
|
||||
show variables like "have_partitioning";
|
||||
enable_query_log;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
|
||||
#
|
||||
# Bug#39893: Crash if select on a partitioned table,
|
||||
# when partitioning is disabled
|
||||
FLUSH TABLES;
|
||||
--copy_file $MYSQLTEST_VARDIR/std_data_ln/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
|
||||
SELECT * FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
ANALYZE TABLE t1;
|
||||
CHECK TABLE t1;
|
||||
OPTIMIZE TABLE t1;
|
||||
REPAIR TABLE t1;
|
||||
ALTER TABLE t1 REPAIR PARTITION ALL;
|
||||
ALTER TABLE t1 CHECK PARTITION ALL;
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
|
||||
ALTER TABLE t1 ANALYZE PARTITION ALL;
|
||||
ALTER TABLE t1 REBUILD PARTITION ALL;
|
||||
ALTER TABLE t1 ENGINE Memory;
|
||||
ALTER TABLE t1 ADD (new INT);
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_FEATURE_DISABLED
|
||||
CREATE TABLE t1 (
|
||||
|
@ -14,6 +14,53 @@
|
||||
drop table if exists t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Bug#46639: 1030 (HY000): Got error 124 from storage engine on
|
||||
# INSERT ... SELECT ...
|
||||
CREATE TABLE t1 (
|
||||
a int NOT NULL,
|
||||
b int NOT NULL);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a int NOT NULL,
|
||||
b int NOT NULL,
|
||||
INDEX(b)
|
||||
)
|
||||
PARTITION BY HASH(a) PARTITIONS 2;
|
||||
|
||||
INSERT INTO t1 VALUES (399, 22);
|
||||
INSERT INTO t2 VALUES (1, 22), (1, 42);
|
||||
|
||||
INSERT INTO t2 SELECT 1, 399 FROM t2, t1
|
||||
WHERE t1.b = t2.b;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# Bug#46478: timestamp field incorrectly defaulted when partition is reorganized
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
b varchar(10),
|
||||
PRIMARY KEY (a)
|
||||
)
|
||||
PARTITION BY RANGE (to_days(a)) (
|
||||
PARTITION p1 VALUES LESS THAN (733407),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES ('2007-07-30 17:35:48', 'p1');
|
||||
INSERT INTO t1 VALUES ('2009-07-14 17:35:55', 'pmax');
|
||||
INSERT INTO t1 VALUES ('2009-09-21 17:31:42', 'pmax');
|
||||
|
||||
SELECT * FROM t1;
|
||||
ALTER TABLE t1 REORGANIZE PARTITION pmax INTO (
|
||||
PARTITION p3 VALUES LESS THAN (733969),
|
||||
PARTITION pmax VALUES LESS THAN MAXVALUE);
|
||||
SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug#36001: Partitions: spelling and using some error messages
|
||||
#
|
||||
|
1
mysql-test/t/partition_disabled-master.opt
Normal file
1
mysql-test/t/partition_disabled-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--loose-skip-partition
|
85
mysql-test/t/partition_disabled.test
Normal file
85
mysql-test/t/partition_disabled.test
Normal file
@ -0,0 +1,85 @@
|
||||
--disable_abort_on_error
|
||||
# Run this test only when mysqld has partitioning, but it is disabled.
|
||||
# The statements are not expected to work, just check that we
|
||||
# can't crash the server.
|
||||
--require r/disabled_partition.require
|
||||
--disable_query_log
|
||||
show variables like "have_partitioning";
|
||||
--enable_query_log
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
|
||||
#
|
||||
# Bug#39893: Crash if select on a partitioned table,
|
||||
# when partitioning is disabled
|
||||
FLUSH TABLES;
|
||||
--copy_file $MYSQLTEST_VARDIR/std_data/parts/t1.frm $MYSQLD_DATADIR/test/t1.frm
|
||||
SELECT * FROM t1;
|
||||
TRUNCATE TABLE t1;
|
||||
ANALYZE TABLE t1;
|
||||
CHECK TABLE t1;
|
||||
OPTIMIZE TABLE t1;
|
||||
REPAIR TABLE t1;
|
||||
ALTER TABLE t1 REPAIR PARTITION ALL;
|
||||
ALTER TABLE t1 CHECK PARTITION ALL;
|
||||
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
|
||||
ALTER TABLE t1 ANALYZE PARTITION ALL;
|
||||
ALTER TABLE t1 REBUILD PARTITION ALL;
|
||||
ALTER TABLE t1 ENGINE Memory;
|
||||
ALTER TABLE t1 ADD (new INT);
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
CREATE TABLE t1 (
|
||||
firstname VARCHAR(25) NOT NULL,
|
||||
lastname VARCHAR(25) NOT NULL,
|
||||
username VARCHAR(16) NOT NULL,
|
||||
email VARCHAR(35),
|
||||
joined DATE NOT NULL
|
||||
)
|
||||
PARTITION BY KEY(joined)
|
||||
PARTITIONS 6;
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
ALTER TABLE t1 PARTITION BY KEY(joined) PARTITIONS 2;
|
||||
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t1;
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
CREATE TABLE t1 (
|
||||
firstname VARCHAR(25) NOT NULL,
|
||||
lastname VARCHAR(25) NOT NULL,
|
||||
username VARCHAR(16) NOT NULL,
|
||||
email VARCHAR(35),
|
||||
joined DATE NOT NULL
|
||||
)
|
||||
PARTITION BY RANGE( YEAR(joined) ) (
|
||||
PARTITION p0 VALUES LESS THAN (1960),
|
||||
PARTITION p1 VALUES LESS THAN (1970),
|
||||
PARTITION p2 VALUES LESS THAN (1980),
|
||||
PARTITION p3 VALUES LESS THAN (1990),
|
||||
PARTITION p4 VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t1;
|
||||
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
CREATE TABLE t1 (id INT, purchased DATE)
|
||||
PARTITION BY RANGE( YEAR(purchased) )
|
||||
SUBPARTITION BY HASH( TO_DAYS(purchased) )
|
||||
SUBPARTITIONS 2 (
|
||||
PARTITION p0 VALUES LESS THAN (1990),
|
||||
PARTITION p1 VALUES LESS THAN (2000),
|
||||
PARTITION p2 VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
--error ER_BAD_TABLE_ERROR
|
||||
drop table t1;
|
||||
|
||||
# Create a table without partitions to test "EXPLAIN PARTITIONS"
|
||||
create table t1 (a varchar(10) charset latin1 collate latin1_bin);
|
||||
insert into t1 values (''),(' '),('a'),('a '),('a ');
|
||||
explain partitions select * from t1 where a='a ' OR a='a';
|
||||
drop table t1;
|
@ -1286,3 +1286,137 @@ CREATE TABLE t1 SELECT 1 % .1234567891234567891234567891234567891234567891234567
|
||||
DESCRIBE t1;
|
||||
SELECT my_col FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug#45261: Crash, stored procedure + decimal
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 81 */ 100000000000000000000000000000000000000000000000000000000000000000000000000000001.1 /* 1 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 82 */ 1000000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 40 */ 1000000000000000000000000000000000000001.1000000000000000000000000000000000000001 /* 40 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 1 */ 1.10000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 80 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 1 */ 1.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
.100000000000000000000000000000000000000000000000000000000000000000000000000000001 /* 81 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 45 */ 123456789012345678901234567890123456789012345.123456789012345678901234567890123456789012345 /* 45 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 65 */ 12345678901234567890123456789012345678901234567890123456789012345.1 /* 1 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
/* 66 */ 123456789012345678901234567890123456789012345678901234567890123456.1 /* 1 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT
|
||||
.123456789012345678901234567890123456789012345678901234567890123456 /* 66 */
|
||||
AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 AS SELECT 123.1234567890123456789012345678901 /* 31 */ AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 SELECT 1.1 + CAST(1 AS DECIMAL(65,30)) AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Test that the integer and decimal parts are properly calculated.
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(30,30));
|
||||
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
|
||||
CREATE TABLE t2 SELECT MIN(a + 0.0000000000000000000000000000001) AS c1 FROM t1;
|
||||
DESC t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(30,30));
|
||||
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
|
||||
CREATE TABLE t2 SELECT IFNULL(a + 0.0000000000000000000000000000001, NULL) AS c1 FROM t1;
|
||||
DESC t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
CREATE TABLE t1 (a DECIMAL(30,30));
|
||||
INSERT INTO t1 VALUES (0.1),(0.2),(0.3);
|
||||
CREATE TABLE t2 SELECT CASE a WHEN 0.1 THEN 0.0000000000000000000000000000000000000000000000000000000000000000001 END AS c1 FROM t1;
|
||||
DESC t2;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # Test that variables get maximum precision.
|
||||
--echo #
|
||||
|
||||
SET @decimal= 1.1;
|
||||
CREATE TABLE t1 SELECT @decimal AS c1;
|
||||
DESC t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
@ -3680,29 +3680,6 @@ SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- Bug#40825: Error 1356 while selecting from a view
|
||||
--echo # -- with a "HAVING" clause though query works
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo
|
||||
|
||||
CREATE TABLE t1 (c INT);
|
||||
|
||||
--echo
|
||||
|
||||
CREATE VIEW v1 (view_column) AS SELECT c AS alias FROM t1 HAVING alias;
|
||||
SHOW CREATE VIEW v1;
|
||||
SELECT * FROM v1;
|
||||
|
||||
--echo
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo
|
||||
--echo # -- End of test case for Bug#40825
|
||||
--echo
|
||||
|
||||
--echo #
|
||||
--echo # Bug #45806 crash when replacing into a view with a join!
|
||||
--echo #
|
||||
@ -3735,6 +3712,29 @@ DROP TABLE t1;
|
||||
|
||||
--echo # -- End of test case for Bug#45806
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- Bug#40825: Error 1356 while selecting from a view
|
||||
--echo # -- with a "HAVING" clause though query works
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo
|
||||
|
||||
CREATE TABLE t1 (c INT);
|
||||
|
||||
--echo
|
||||
|
||||
CREATE VIEW v1 (view_column) AS SELECT c AS alias FROM t1 HAVING alias;
|
||||
SHOW CREATE VIEW v1;
|
||||
SELECT * FROM v1;
|
||||
|
||||
--echo
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo
|
||||
--echo # -- End of test case for Bug#40825
|
||||
--echo
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
--echo # -- End of 5.0 tests.
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user