File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -9218,4 +9218,30 @@ public function testAlterTableDropCheckConstraint(): void {
92189218 $ result = $ this ->assertQuery ( 'SELECT * FROM t ' );
92199219 $ this ->assertCount ( 2 , $ result );
92209220 }
9221+
9222+ public function testCheckConstraintNotEnforced (): void {
9223+ $ this ->assertQuery ( 'CREATE TABLE t (id INT, CONSTRAINT c CHECK (id > 0) NOT ENFORCED) ' );
9224+
9225+ // Insert data that would violate the constraints.
9226+ $ this ->assertQuery ( 'INSERT INTO t (id) VALUES (0) ' );
9227+
9228+ $ result = $ this ->assertQuery ( 'SELECT * FROM t ' );
9229+ $ this ->assertCount ( 1 , $ result );
9230+
9231+ // SHOW CREATE TABLE
9232+ $ this ->assertQuery ( 'SHOW CREATE TABLE t ' );
9233+ $ result = $ this ->engine ->get_query_results ();
9234+ $ this ->assertEquals (
9235+ implode (
9236+ "\n" ,
9237+ array (
9238+ 'CREATE TABLE `t` ( ' ,
9239+ ' `id` int DEFAULT NULL, ' ,
9240+ ' CONSTRAINT `c` CHECK ( id > 0 ) /*!80016 NOT ENFORCED */ ' ,
9241+ ') ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ' ,
9242+ )
9243+ ),
9244+ $ result [0 ]->{'Create Table ' }
9245+ );
9246+ }
92219247}
You can’t perform that action at this time.
0 commit comments