diff --git a/pkg/session/session.go b/pkg/session/session.go index cd8496f0598e0..2988823d40ccc 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -4413,6 +4413,12 @@ func (s *session) usePipelinedDmlOrWarn() bool { } if s.GetSessionVars().ConstraintCheckInPlace { // we enforce that pipelined DML must lazily check key. + stmtCtx.AppendWarning( + errors.New( + "Pipelined DML can not be used when tidb_constraint_check_in_place=ON. " + + "Fallback to standard mode", + ), + ) return false } is, ok := s.GetDomainInfoSchema().(infoschema.InfoSchema) diff --git a/tests/realtikvtest/pipelineddmltest/pipelineddml_test.go b/tests/realtikvtest/pipelineddmltest/pipelineddml_test.go index 8185105da17e8..4d5cd4685aab4 100644 --- a/tests/realtikvtest/pipelineddmltest/pipelineddml_test.go +++ b/tests/realtikvtest/pipelineddmltest/pipelineddml_test.go @@ -209,6 +209,12 @@ func TestPipelinedDMLNegative(t *testing.T) { tk.MustExec("insert into t values(10, 10)") tk.MustQuery("show warnings").CheckContain("Pipelined DML can not be used without Metadata Lock. Fallback to standard mode") tk.MustExec("set global tidb_enable_metadata_lock = on") + + // tidb_constraint_check_in_place = ON + tk.MustExec("set @@tidb_constraint_check_in_place = 1") + tk.MustExec("insert into t values(11, 11)") + tk.MustQuery("show warnings").CheckContain("Pipelined DML can not be used when tidb_constraint_check_in_place=ON. Fallback to standard mode") + tk.MustExec("set @@tidb_constraint_check_in_place = 0") } func compareTables(t *testing.T, tk *testkit.TestKit, t1, t2 string) {