-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stonedb-5.7-dev' into stonedb-5.7-dev
- Loading branch information
Showing
9 changed files
with
167 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
DROP DATABASE IF EXISTS issue1318_test; | ||
CREATE DATABASE issue1318_test; | ||
USE issue1318_test; | ||
# | ||
# Secondary INDEX | ||
# | ||
CREATE TABLE tb_stu_info1 (id int(11) NOT NULL, height int(11) DEFAULT NULL,KEY height (height)) ENGINE=TIANMU; | ||
CREATE TABLE tb_stu_info2 (id int(11) NOT NULL, height int(11) DEFAULT NULL,INDEX height (height)) ENGINE=TIANMU; | ||
CREATE TABLE tb_stu_info3 (id int, col_name varchar(10)) ENGINE=TIANMU; | ||
CREATE INDEX index_name ON tb_stu_info3(col_name); | ||
ALTER TABLE tb_stu_info3 DROP INDEX index_name; | ||
ALTER TABLE tb_stu_info3 add INDEX index_name (col_name) ; | ||
# | ||
# UNIQUE INDEX | ||
# | ||
CREATE TABLE tb_stu_info_1 (id int(11) NOT NULL, height int(11) DEFAULT NULL,UNIQUE KEY height (height)) ENGINE=TIANMU; | ||
CREATE TABLE tb_stu_info_2 (id int(11) NOT NULL, height int(11) DEFAULT NULL,UNIQUE INDEX height (height)) ENGINE=TIANMU; | ||
CREATE TABLE tb_stu_info_3 (id int(11) NOT NULL, height int(11) DEFAULT NULL) ENGINE=TIANMU; | ||
ALTER TABLE tb_stu_info_3 ADD CONSTRAINT constraint_name UNIQUE INDEX(height); | ||
ALTER TABLE tb_stu_info_3 DROP INDEX constraint_name; | ||
# | ||
# TRIGGER | ||
# | ||
CREATE TABLE employees( | ||
id INT auto_increment PRIMARY KEY, | ||
employeeNumber INT NOT NULL, | ||
lastname VARCHAR(50) NOT NULL, | ||
action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; | ||
CREATE TABLE employees_audit( | ||
id INT auto_increment PRIMARY KEY, | ||
employeeNumber INT NOT NULL, | ||
lastname VARCHAR(50) NOT NULL, | ||
action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; | ||
CREATE TABLE employees_audit2( | ||
id INT auto_increment PRIMARY KEY, | ||
employeeNumber INT NOT NULL, | ||
lastname VARCHAR(50) NOT NULL, | ||
action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; | ||
CREATE TRIGGER before_employee_update | ||
BEFORE UPDATE ON employees | ||
FOR EACH ROW | ||
BEGIN | ||
INSERT INTO employees_audit | ||
SET action = 'update', | ||
employeeNumber = 1, | ||
lastname = "nihao", | ||
new_lastname = "niyehao"; | ||
END | | ||
# | ||
# END | ||
# | ||
DROP DATABASE issue1318_test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,NO_KEY_ERROR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
--source include/have_tianmu.inc | ||
|
||
--disable_warnings | ||
DROP DATABASE IF EXISTS issue1318_test; | ||
--enable_warnings | ||
|
||
CREATE DATABASE issue1318_test; | ||
|
||
USE issue1318_test; | ||
|
||
--echo # | ||
--echo # Secondary INDEX | ||
--echo # | ||
|
||
CREATE TABLE tb_stu_info1 (id int(11) NOT NULL, height int(11) DEFAULT NULL,KEY height (height)) ENGINE=TIANMU; | ||
|
||
CREATE TABLE tb_stu_info2 (id int(11) NOT NULL, height int(11) DEFAULT NULL,INDEX height (height)) ENGINE=TIANMU; | ||
|
||
CREATE TABLE tb_stu_info3 (id int, col_name varchar(10)) ENGINE=TIANMU; | ||
|
||
CREATE INDEX index_name ON tb_stu_info3(col_name); | ||
|
||
ALTER TABLE tb_stu_info3 DROP INDEX index_name; | ||
|
||
ALTER TABLE tb_stu_info3 add INDEX index_name (col_name) ; | ||
|
||
|
||
--echo # | ||
--echo # UNIQUE INDEX | ||
--echo # | ||
|
||
CREATE TABLE tb_stu_info_1 (id int(11) NOT NULL, height int(11) DEFAULT NULL,UNIQUE KEY height (height)) ENGINE=TIANMU; | ||
|
||
CREATE TABLE tb_stu_info_2 (id int(11) NOT NULL, height int(11) DEFAULT NULL,UNIQUE INDEX height (height)) ENGINE=TIANMU; | ||
|
||
CREATE TABLE tb_stu_info_3 (id int(11) NOT NULL, height int(11) DEFAULT NULL) ENGINE=TIANMU; | ||
|
||
ALTER TABLE tb_stu_info_3 ADD CONSTRAINT constraint_name UNIQUE INDEX(height); | ||
|
||
ALTER TABLE tb_stu_info_3 DROP INDEX constraint_name; | ||
|
||
|
||
--echo # | ||
--echo # TRIGGER | ||
--echo # | ||
|
||
CREATE TABLE employees( | ||
id INT auto_increment PRIMARY KEY, | ||
employeeNumber INT NOT NULL, | ||
lastname VARCHAR(50) NOT NULL, | ||
action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; | ||
|
||
CREATE TABLE employees_audit( | ||
id INT auto_increment PRIMARY KEY, | ||
employeeNumber INT NOT NULL, | ||
lastname VARCHAR(50) NOT NULL, | ||
action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; | ||
|
||
CREATE TABLE employees_audit2( | ||
id INT auto_increment PRIMARY KEY, | ||
employeeNumber INT NOT NULL, | ||
lastname VARCHAR(50) NOT NULL, | ||
action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; | ||
|
||
|
||
DELIMITER |; | ||
CREATE TRIGGER before_employee_update | ||
BEFORE UPDATE ON employees | ||
FOR EACH ROW | ||
BEGIN | ||
INSERT INTO employees_audit | ||
SET action = 'update', | ||
employeeNumber = 1, | ||
lastname = "nihao", | ||
new_lastname = "niyehao"; | ||
END | | ||
DELIMITER ;| | ||
|
||
|
||
--echo # | ||
--echo # END | ||
--echo # | ||
|
||
DROP DATABASE issue1318_test; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters