mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 14:02:32 +01:00
c9a465bb14
------------------------------------------------------------------------ r6521 | marko | 2010-01-27 10:49:01 +0200 (Wed, 27 Jan 2010) | 17 lines branches/zip: Drop temporary tables at startup. This addresses the third aspect of Bug #41609. row_mysql_drop_temp_tables(): New function, to drop all temporary tables. These can be distinguished by the least significant bit of MIX_LEN. However, we will skip ROW_FORMAT=REDUNDANT tables, because in the records for those tables, that bit may be garbage. recv_recovery_from_checkpoint_finish(): Invoke row_mysql_drop_temp_tables(). Normally, if the .frm files for the temporary tables exist at startup, MySQL will ask InnoDB to drop the temporary tables. However, if the files are deleted, for instance, by the boot scripts of the operating system, the tables would remain in the InnoDB data dictionary unless someone digs them up by innodb_table_monitor and creates .frm files for dropping the tables. rb://221 approved by Sunny Bains. ------------------------------------------------------------------------ r6525 | marko | 2010-01-28 16:23:15 +0200 (Thu, 28 Jan 2010) | 11 lines branches/zip: buf_LRU_invalidate_tablespace(): Do not unnecessarily acquire the block_mutex for every block in the LRU list. Only acquire it when holding buf_pool_mutex is not sufficient. This should speed up the function and considerably reduce traffic on the memory bus and caches. I noticed this deficiency when working on Issue #157. This deficiency popped up again in Issue #449 (Bug #35077), which this fix does not fully address. rb://78 revision 1 approved by Heikki Tuuri. ------------------------------------------------------------------------ r6526 | jyang | 2010-01-28 18:12:40 +0200 (Thu, 28 Jan 2010) | 8 lines branches/zip: Add index translation table to map mysql index number to InnoDB index structure directly. Fix Bug #47622: "the new index is added before the existing ones in MySQL, but after one in SE". rb://215, approved by Marko ------------------------------------------------------------------------ r6527 | vasil | 2010-01-29 14:39:48 +0200 (Fri, 29 Jan 2010) | 6 lines branches/zip: Extend the comment about row_mysql_handle_errors(). Suggested by: Heikki ------------------------------------------------------------------------ r6533 | calvin | 2010-01-29 23:31:59 +0200 (Fri, 29 Jan 2010) | 4 lines branches/zip: remove duplicated copyright and license info. ------------------------------------------------------------------------ r6534 | sunny | 2010-01-29 23:42:49 +0200 (Fri, 29 Jan 2010) | 15 lines branches/zip: Two changes to fix the problem: 1. First scan the joining transaction's locks and check if no other transaction is waiting for a lock held by the joining transaction. If no other transaction is waiting then no deadlock an occur and we avoid doing an exhaustive search. 2. Change the direction of the lock traversal from backward to forward. Previously we traversed backward from the lock that has to wait, the function to that fetched the previous node was very inefficient resulting in O(n^2) access to the rec lock list. Fix Bug #49047 InnoDB deadlock detection is CPU intensive with many locks on a single row. rb://218 ------------------------------------------------------------------------ r6539 | marko | 2010-02-01 11:31:12 +0200 (Mon, 01 Feb 2010) | 75 lines branches/zip: Merge revisions 6471:6538 from branches/5.1: ------------------------------------------------------------------------ r6488 | sunny | 2010-01-21 02:55:08 +0200 (Thu, 21 Jan 2010) | 2 lines Changed paths: M /branches/5.1/mysql-test/innodb-autoinc.result M /branches/5.1/mysql-test/innodb-autoinc.test branches/5.1: Factor out test for bug#44030 from innodb-autoinc.test into a separate test/result files. ------------------------------------------------------------------------ r6489 | sunny | 2010-01-21 02:57:50 +0200 (Thu, 21 Jan 2010) | 2 lines Changed paths: A /branches/5.1/mysql-test/innodb-autoinc-44030.result A /branches/5.1/mysql-test/innodb-autoinc-44030.test branches/5.1: Factor out test for bug#44030 from innodb-autoinc.test into a separate test/result files. ------------------------------------------------------------------------ r6492 | sunny | 2010-01-21 09:38:35 +0200 (Thu, 21 Jan 2010) | 1 line Changed paths: M /branches/5.1/mysql-test/innodb-autoinc-44030.test branches/5.1: Add reference to bug#47621 in the comment. ------------------------------------------------------------------------ r6535 | sunny | 2010-01-30 00:08:40 +0200 (Sat, 30 Jan 2010) | 11 lines Changed paths: M /branches/5.1/handler/ha_innodb.cc branches/5.1: Undo the change from r6424. We need to return DB_SUCCESS even if we were unable to initialize the tabe autoinc value. This is required for the open to succeed. The only condition we currently treat as a hard error is if the autoinc field instance passed in by MySQL is NULL. Previously if the table autoinc value was 0 and the next value was requested we had an assertion that would fail. Change that assertion and treat a value of 0 to mean that the autoinc system is unavailable. Generation of next value will now return failure. rb://237 ------------------------------------------------------------------------ r6536 | sunny | 2010-01-30 00:13:42 +0200 (Sat, 30 Jan 2010) | 6 lines Changed paths: M /branches/5.1/handler/ha_innodb.cc M /branches/5.1/mysql-test/innodb-autoinc.result M /branches/5.1/mysql-test/innodb-autoinc.test branches/5.1: Check *first_value everytime against the column max value and set *first_value to next autoinc if it's > col max value. ie. not rely on what is passed in from MySQL. [49497] Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value rb://236 ------------------------------------------------------------------------ r6537 | sunny | 2010-01-30 00:35:00 +0200 (Sat, 30 Jan 2010) | 2 lines Changed paths: M /branches/5.1/handler/ha_innodb.cc M /branches/5.1/mysql-test/innodb-autoinc.result M /branches/5.1/mysql-test/innodb-autoinc.test branches/5.1: Undo r6536. ------------------------------------------------------------------------ r6538 | sunny | 2010-01-30 00:43:06 +0200 (Sat, 30 Jan 2010) | 6 lines Changed paths: M /branches/5.1/handler/ha_innodb.cc M /branches/5.1/mysql-test/innodb-autoinc.result M /branches/5.1/mysql-test/innodb-autoinc.test branches/5.1: Check *first_value every time against the column max value and set *first_value to next autoinc if it's > col max value. ie. not rely on what is passed in from MySQL. [49497] Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value rb://236 ------------------------------------------------------------------------ ------------------------------------------------------------------------ r6540 | marko | 2010-02-01 11:35:13 +0200 (Mon, 01 Feb 2010) | 1 line branches/zip: ChangeLog: Document the merge of 6471:6538 from branches/5.1. ------------------------------------------------------------------------ r6546 | jyang | 2010-02-03 11:05:24 +0200 (Wed, 03 Feb 2010) | 9 lines branches/zip: Relax assertion on the number of index defined in InnoDB must be comparable with that of MySQL to tolerate possible dictionary inconsistency. Fix Mantis issue #455, "UNIV_DEBUG+ assert ha_innodb.cc:3152 ib_num_index >= mysql_num_index". rb://248 Approved by Marko. ------------------------------------------------------------------------ r6547 | marko | 2010-02-03 14:43:38 +0200 (Wed, 03 Feb 2010) | 14 lines branches/zip: Clean up CHECK TABLE error handling. (Issue #220) ha_innobase::change_active_index(): Clean up code formatting. ha_innobase::check(): Incorporate the code from row_check_table_for_mysql(). Report errors to the client connection instead of writing them to the error log. row_check_table_for_mysql(): Remove. row_check_index_for_mysql(): Renamed from row_scan_and_check_index(). Let the caller initialize prebuilt, and assume that the index is usable. rb://178 approved by Sunny Bains ------------------------------------------------------------------------ r6548 | marko | 2010-02-03 15:01:39 +0200 (Wed, 03 Feb 2010) | 11 lines branches/zip: buf_LRU_invalidate_tablespace(): Ensure that prev_bpage is not relocated when freeing a compressed block. This avoids the costly rescan of the LRU list. (Bug #35077, Issue #449) At most one buffer-fix will be active at a time, affecting two blocks: the buf_page_t and the compressed page frame. This should not block the memory defragmentation in buf0buddy.c too much. In fact, it may avoid unnecessary copying if also prev_bpage belongs to the tablespace that is being invalidated. rb://240 ------------------------------------------------------------------------ r6559 | marko | 2010-02-04 13:21:18 +0200 (Thu, 04 Feb 2010) | 14 lines branches/zip: Pass the file name and line number of the caller of the b-tree cursor functions to the buffer pool requests, in order to make the latch diagnostics more accurate. buf_page_optimistic_get_func(): Renamed to buf_page_optimistic_get(). btr_page_get_father_node_ptr(), btr_insert_on_non_leaf_level(), btr_pcur_open(), btr_pcur_open_with_no_init(), btr_pcur_open_on_user_rec(), btr_pcur_open_at_rnd_pos(), btr_pcur_restore_position(), btr_cur_open_at_index_side(), btr_cur_open_at_rnd_pos(): Rename the function to _func and add the parameters file, line. Define wrapper macros with __FILE__, __LINE__. btr_cur_search_to_nth_level(): Add the parameters file, line. ------------------------------------------------------------------------ r6560 | sunny | 2010-02-04 16:11:23 +0200 (Thu, 04 Feb 2010) | 7 lines branches/zip: Remove the additional check introduced in r6534 which tries to check if the joining transaction has any other transactions waiting on its locks. This optimization results in excessive deadlocks when running Sysbench with a large number of threads. The function seems to return FALSE positives. rb://250 ------------------------------------------------------------------------
664 lines
23 KiB
Text
664 lines
23 KiB
Text
-- source include/have_innodb.inc
|
|
# embedded server ignores 'delayed', so skip this
|
|
-- source include/not_embedded.inc
|
|
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
|
|
#
|
|
# Bug #34335
|
|
#
|
|
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (9223372036854775807, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
## Test AUTOINC overflow
|
|
##
|
|
|
|
# TINYINT
|
|
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (127, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (255, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# SMALLINT
|
|
#
|
|
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (32767, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (65535, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# MEDIUMINT
|
|
#
|
|
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (8388607, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (16777215, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# INT
|
|
#
|
|
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (2147483647, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (4294967295, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# BIGINT
|
|
#
|
|
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (9223372036854775807, null);
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (18446744073709551615, null);
|
|
-- error ER_AUTOINC_READ_FAILED,1467
|
|
INSERT INTO t1 (c2) VALUES ('innodb');
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Bug 37531
|
|
# After truncate, auto_increment behaves incorrectly for InnoDB
|
|
#
|
|
CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
|
SELECT c1 FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
TRUNCATE TABLE t1;
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
|
SELECT c1 FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Deleting all records should not reset the AUTOINC counter.
|
|
#
|
|
CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
|
SELECT c1 FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DELETE FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
INSERT INTO t1 VALUES (NULL), (NULL), (NULL);
|
|
SELECT c1 FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Bug 38839
|
|
# Reset the last value generated at end of statement
|
|
#
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (NULL, 1);
|
|
DELETE FROM t1 WHERE c1 = 1;
|
|
INSERT INTO t1 VALUES (2,1);
|
|
INSERT INTO t1 VALUES (NULL,8);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
# Bug 38839 -- same as above but for multi value insert
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (NULL, 1);
|
|
DELETE FROM t1 WHERE c1 = 1;
|
|
INSERT INTO t1 VALUES (2,1), (NULL, 8);
|
|
INSERT INTO t1 VALUES (NULL,9);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Test changes to AUTOINC next value calculation
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (NULL),(5),(NULL);
|
|
INSERT INTO t1 VALUES (250),(NULL);
|
|
SELECT * FROM t1;
|
|
INSERT INTO t1 VALUES (1000);
|
|
SET @@INSERT_ID=400;
|
|
INSERT INTO t1 VALUES(NULL),(NULL);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
# Test with SIGNED INT column, by inserting a 0 for the first column value
|
|
# 0 is treated in the same was NULL.
|
|
# Reset the AUTOINC session variables
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(0);
|
|
SELECT * FROM t1;
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
|
INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL);
|
|
INSERT INTO t1 VALUES (250),(NULL);
|
|
SELECT * FROM t1;
|
|
SET @@INSERT_ID=400;
|
|
# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 VALUES(NULL),(NULL);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
# Test with SIGNED INT column
|
|
# Reset the AUTOINC session variables
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(-1);
|
|
SELECT * FROM t1;
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL);
|
|
INSERT INTO t1 VALUES (250),(NULL);
|
|
SELECT * FROM t1;
|
|
INSERT INTO t1 VALUES (1000);
|
|
SET @@INSERT_ID=400;
|
|
INSERT INTO t1 VALUES(NULL),(NULL);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
# Test with UNSIGNED INT column, single insert
|
|
# The sign in the value is ignored and a new column value is generated
|
|
# Reset the AUTOINC session variables
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(-1);
|
|
SELECT * FROM t1;
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
INSERT INTO t1 VALUES (-2);
|
|
INSERT INTO t1 VALUES (NULL);
|
|
INSERT INTO t1 VALUES (2);
|
|
INSERT INTO t1 VALUES (NULL);
|
|
INSERT INTO t1 VALUES (250);
|
|
INSERT INTO t1 VALUES (NULL);
|
|
SELECT * FROM t1;
|
|
INSERT INTO t1 VALUES (1000);
|
|
SET @@INSERT_ID=400;
|
|
INSERT INTO t1 VALUES(NULL);
|
|
INSERT INTO t1 VALUES(NULL);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
# Test with UNSIGNED INT column, multi-value inserts
|
|
# The sign in the value is ignored and a new column value is generated
|
|
# Reset the AUTOINC session variables
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(-1);
|
|
SELECT * FROM t1;
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL);
|
|
INSERT INTO t1 VALUES (250),(NULL);
|
|
SELECT * FROM t1;
|
|
INSERT INTO t1 VALUES (1000);
|
|
SET @@INSERT_ID=400;
|
|
# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 VALUES(NULL),(NULL);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Check for overflow handling when increment is > 1
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
# TODO: Fix the autoinc init code
|
|
# We have to do this because of a bug in the AUTOINC init code.
|
|
INSERT INTO t1 VALUES(NULL);
|
|
INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14
|
|
SELECT * FROM t1;
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
# This should just fit
|
|
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Check for overflow handling when increment and offser are > 1
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
# TODO: Fix the autoinc init code
|
|
# We have to do this because of a bug in the AUTOINC init code.
|
|
INSERT INTO t1 VALUES(NULL);
|
|
INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
|
|
SELECT * FROM t1;
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
# This should fail because of overflow but it doesn't, it seems to be
|
|
# a MySQL server bug. It wraps around to 0 for the last value.
|
|
# See MySQL Bug# 39828
|
|
#
|
|
# Instead of wrapping around, it asserts when MySQL is compiled --with-debug
|
|
# (see sql/handler.cc:handler::update_auto_increment()). Don't test for
|
|
# overflow until Bug #39828 is fixed.
|
|
#
|
|
# Since this asserts when compiled --with-debug, we can't properly test this
|
|
# until Bug #39828 is fixed. For now, this test is meaningless.
|
|
#if Bug #39828 is fixed
|
|
#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
|
#else
|
|
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
|
#endif
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Check for overflow handling when increment and offset are odd numbers
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
# TODO: Fix the autoinc init code
|
|
# We have to do this because of a bug in the AUTOINC init code.
|
|
INSERT INTO t1 VALUES(NULL);
|
|
INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13
|
|
SELECT * FROM t1;
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
# This should fail because of overflow but it doesn't. It fails with
|
|
# a duplicate entry message because of a MySQL server bug, it wraps
|
|
# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace
|
|
# the ER_DUP_ENTRY, 1062 below with the appropriate error message
|
|
#
|
|
# Since this asserts when compiled --with-debug, we can't properly test this
|
|
# until Bug #39828 is fixed. For now, this test is meaningless.
|
|
#if Bug #39828 is fixed
|
|
# Still need to fix this error code, error should mention overflow
|
|
#-- error ER_DUP_ENTRY,1062
|
|
#INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
|
|
#else
|
|
INSERT INTO t1 VALUES (NULL),(NULL);
|
|
#endif
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
# Check for overflow handling when increment and offset are odd numbers
|
|
# and check for large -ve numbers
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
# TODO: Fix the autoinc init code
|
|
# We have to do this because of a bug in the AUTOINC init code.
|
|
INSERT INTO t1 VALUES(NULL);
|
|
INSERT INTO t1 VALUES(-9223372036854775806); #-- -2^63 + 2
|
|
INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1
|
|
INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63
|
|
SELECT * FROM t1;
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
INSERT INTO t1 VALUES (NULL),(NULL), (NULL);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# Check for overflow handling when increment and offset are very
|
|
# large numbers 2^60
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB;
|
|
# TODO: Fix the autoinc init code
|
|
# We have to do this because of a bug in the AUTOINC init code.
|
|
INSERT INTO t1 VALUES(NULL);
|
|
INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
|
|
SELECT * FROM t1;
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
# This should fail because of overflow but it doesn't. It wraps around
|
|
# and the autoinc values look bogus too.
|
|
# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error
|
|
# code expected test.
|
|
# -- error ER_AUTOINC_READ_FAILED,1467
|
|
#
|
|
# Since this asserts when compiled --with-debug, we can't properly test this
|
|
# until Bug #39828 is fixed. For now, this test is meaningless.
|
|
#if Bug #39828 is fixed
|
|
#-- error ER_AUTOINC_READ_FAILED,1467
|
|
#INSERT INTO t1 VALUES (NULL),(NULL);
|
|
#else
|
|
INSERT INTO t1 VALUES (NULL);
|
|
#endif
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Check for floating point autoinc column handling
|
|
#
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SET @@INSERT_ID=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(NULL, 1);
|
|
INSERT INTO t1 VALUES(NULL, 2);
|
|
SELECT * FROM t1;
|
|
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
|
|
SELECT * FROM t1;
|
|
INSERT INTO t1 VALUES(NULL, 3);
|
|
INSERT INTO t1 VALUES(NULL, 4);
|
|
SELECT * FROM t1;
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES(NULL, 1);
|
|
INSERT INTO t1 VALUES(NULL, 2);
|
|
SELECT * FROM t1;
|
|
ALTER TABLE t1 CHANGE c1 c1 SERIAL;
|
|
SELECT * FROM t1;
|
|
INSERT INTO t1 VALUES(NULL, 3);
|
|
INSERT INTO t1 VALUES(NULL, 4);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
#
|
|
# Bug# 42714: AUTOINC column calculated next value not greater than highest
|
|
# value stored in table.
|
|
#
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP TABLE IF EXISTS t2;
|
|
CREATE TABLE t1 (
|
|
a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
b INT(10) UNSIGNED NOT NULL,
|
|
c ENUM('FALSE','TRUE') DEFAULT NULL,
|
|
PRIMARY KEY (a)) ENGINE = InnoDB;
|
|
CREATE TABLE t2 (
|
|
m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
n INT(10) UNSIGNED NOT NULL,
|
|
o enum('FALSE','TRUE') DEFAULT NULL,
|
|
PRIMARY KEY (m)) ENGINE = InnoDB;
|
|
INSERT INTO t2 (n,o) VALUES
|
|
(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'),
|
|
(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false');
|
|
SHOW CREATE TABLE t2;
|
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
#
|
|
# 43203: Overflow from auto incrementing causes server segv
|
|
#
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP TABLE IF EXISTS t2;
|
|
CREATE TABLE t1(
|
|
c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT
|
|
PRIMARY KEY) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
|
|
CREATE TABLE t2(
|
|
c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT
|
|
PRIMARY KEY) ENGINE=InnoDB;
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t2 SELECT c1 FROM t1;
|
|
-- error ER_DUP_ENTRY,1467
|
|
INSERT INTO t2 SELECT NULL FROM t1;
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
|
|
# If the user has specified negative values for an AUTOINC column then
|
|
# InnoDB should ignore those values when setting the table's max value.
|
|
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
|
|
SHOW VARIABLES LIKE "%auto_inc%";
|
|
# TINYINT
|
|
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-127, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-127, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# SMALLINT
|
|
#
|
|
CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-32767, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-32757, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# MEDIUMINT
|
|
#
|
|
CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-8388607, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-8388607, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# INT
|
|
#
|
|
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-2147483647, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-2147483647, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# BIGINT
|
|
#
|
|
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1, NULL);
|
|
INSERT INTO t1 VALUES (-1, 'innodb');
|
|
INSERT INTO t1 VALUES (-9223372036854775807, 'innodb');
|
|
INSERT INTO t1 VALUES (NULL, NULL);
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
#
|
|
# End negative number check
|
|
|
|
##
|
|
# 47125: auto_increment start value is ignored if an index is created
|
|
# and engine=innodb
|
|
#
|
|
CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) AUTO_INCREMENT=10 ENGINE=InnoDB;
|
|
CREATE INDEX i1 on t1(c2);
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 (c2) values (0);
|
|
SELECT * FROM t1;
|
|
DROP TABLE t1;
|
|
|
|
##
|
|
# 49032: Use the correct function to read the AUTOINC column value
|
|
#
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1(C1 DOUBLE AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
|
|
# Restart the server
|
|
-- source include/restart_mysqld.inc
|
|
INSERT INTO t1(C2) VALUES ('innodb');
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1(C1 FLOAT AUTO_INCREMENT KEY, C2 CHAR(10)) ENGINE=InnoDB;
|
|
INSERT INTO t1(C1, C2) VALUES (1, 'innodb'), (3, 'innodb');
|
|
# Restart the server
|
|
-- source include/restart_mysqld.inc
|
|
INSERT INTO t1(C2) VALUES ('innodb');
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
|
|
##
|
|
# 47720: REPLACE INTO Autoincrement column with negative values
|
|
#
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 INT AUTO_INCREMENT PRIMARY KEY) ENGINE=InnoDB;
|
|
INSERT INTO t1 SET c1 = 1;
|
|
SHOW CREATE TABLE t1;
|
|
INSERT INTO t1 SET c1 = 2;
|
|
INSERT INTO t1 SET c1 = -1;
|
|
SELECT * FROM t1;
|
|
-- error ER_DUP_ENTRY,1062
|
|
INSERT INTO t1 SET c1 = -1;
|
|
SHOW CREATE TABLE t1;
|
|
REPLACE INTO t1 VALUES (-1);
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
|
|
##
|
|
# 49497: Error 1467 (ER_AUTOINC_READ_FAILED) on inserting a negative value
|
|
#
|
|
DROP TABLE IF EXISTS t1;
|
|
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (-685113344), (1), (NULL), (NULL);
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (-685113344), (2), (NULL), (NULL);
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (NULL);
|
|
INSERT INTO t1 VALUES (4), (5), (6), (NULL);
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (NULL), (2), (-685113344), (5);
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|
|
CREATE TABLE t1 (c1 INTEGER AUTO_INCREMENT, PRIMARY KEY (c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1), (2), (-685113344), (NULL);
|
|
SELECT * FROM t1;
|
|
SHOW CREATE TABLE t1;
|
|
DROP TABLE t1;
|