Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
686865e1
Commit
686865e1
authored
Dec 15, 2023
by
Thirunarayanan Balathandayuthapani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust the MDEV-26052 test case for MDEV-29092
parent
655f78a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
mysql-test/suite/innodb/r/truncate_foreign.result
mysql-test/suite/innodb/r/truncate_foreign.result
+5
-4
mysql-test/suite/innodb/t/truncate_foreign.test
mysql-test/suite/innodb/t/truncate_foreign.test
+4
-6
No files found.
mysql-test/suite/innodb/r/truncate_foreign.result
View file @
686865e1
...
...
@@ -77,25 +77,26 @@ DROP TABLE t1;
call mtr.add_suppression("InnoDB: In ALTER TABLE `test`\\.`t1` has or is");
CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a)) ENGINE=InnoDB;
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t
1
(a), ALGORITHM=COPY;
ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t
2
(a), ALGORITHM=COPY;
INSERT INTO t1 VALUES (1,1);
CREATE TABLE t2(f1 INT PRIMARY KEY)ENGINE=InnoDB;
LOCK TABLES t1 WRITE;
SET FOREIGN_KEY_CHECKS=1;
TRUNCATE t1;
ERROR HY000: Cannot add foreign key constraint for `t1`
INSERT INTO t1 VALUES (2,2);
ERROR
HY000: Table 't1' was not locked with LOCK TABLES
ERROR
23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t2` (`a`))
SELECT * FROM t1;
pk a
1 1
UNLOCK TABLES;
INSERT INTO t1 VALUES (2,2);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t
1
` (`a`))
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t
2
` (`a`))
SET FOREIGN_KEY_CHECKS=0;
INSERT INTO t1 VALUES (2,2);
SELECT * FROM t1;
pk a
1 1
2 2
DROP TABLE t1;
DROP TABLE t
2, t
1;
# End of 10.6 tests
mysql-test/suite/innodb/t/truncate_foreign.test
View file @
686865e1
...
...
@@ -89,16 +89,14 @@ call mtr.add_suppression("InnoDB: In ALTER TABLE `test`\\.`t1` has or is");
CREATE
TABLE
t1
(
pk
INT
,
a
INT
,
PRIMARY
KEY
(
pk
),
KEY
(
a
))
ENGINE
=
InnoDB
;
SET
FOREIGN_KEY_CHECKS
=
0
;
ALTER
TABLE
t1
ADD
FOREIGN
KEY
(
a
)
REFERENCES
t
1
(
a
),
ALGORITHM
=
COPY
;
ALTER
TABLE
t1
ADD
FOREIGN
KEY
(
a
)
REFERENCES
t
2
(
a
),
ALGORITHM
=
COPY
;
INSERT
INTO
t1
VALUES
(
1
,
1
);
CREATE
TABLE
t2
(
f1
INT
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
LOCK
TABLES
t1
WRITE
;
SET
FOREIGN_KEY_CHECKS
=
1
;
--
error
ER_CANNOT_ADD_FOREIGN
TRUNCATE
t1
;
# Whether TRUNCATE succeeds or fails, it will reload FOREIGN KEY constraints.
# As a result, ha_innobase::referenced_by_foreign_key() will retun TRUE
# (for the self-referential key), and the statement will fail.
--
error
ER_TABLE_NOT_LOCKED
--
error
ER_NO_REFERENCED_ROW_2
INSERT
INTO
t1
VALUES
(
2
,
2
);
SELECT
*
FROM
t1
;
UNLOCK
TABLES
;
...
...
@@ -107,6 +105,6 @@ INSERT INTO t1 VALUES (2,2);
SET
FOREIGN_KEY_CHECKS
=
0
;
INSERT
INTO
t1
VALUES
(
2
,
2
);
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
DROP
TABLE
t
2
,
t
1
;
--
echo
# End of 10.6 tests
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment