Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table: fix zero date in different sqlmode (#20206) #21553

Merged
merged 16 commits into from
Jan 29, 2021

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #20206 to release-4.0


What problem does this PR solve?

Issue Number: close #19892, #19634

Problem Summary:

What is changed and how it works?

What's Changed:

How it Works:

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

Side effects

Release note

  • The same behavior of NO_ZERO_DATE and NO_ZERO_IN_DATE to MySQL's in INSERT/UPDATE statement

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@lzmhhh123 you're already a collaborator in bot's repo.

@wjhuang2016
Copy link
Member

@9547 @lzmhhh123 PTAL

@9547
Copy link
Contributor

9547 commented Dec 8, 2020

@wjhuang2016 Seems there exist some code conflicts after the cherry-pick, IMO, we should resolve those conflicts manually.

@github-actions github-actions bot added the sig/sql-infra SIG: SQL Infra label Jan 7, 2021
@jebter jebter modified the milestones: 4.0.0, v4.0.11 Jan 7, 2021
@zz-jason zz-jason added the type/bugfix This PR fixes a bug. label Jan 25, 2021
lzmhhh123 and others added 3 commits January 26, 2021 16:18
Signed-off-by: lzmhhh123 <lzmhhh123@gmail.com>
Signed-off-by: lzmhhh123 <lzmhhh123@gmail.com>
Copy link
Contributor

@qw4990 qw4990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 27, 2021
@qw4990
Copy link
Contributor

qw4990 commented Jan 27, 2021

/run-all-tests

lzmhhh123 and others added 2 commits January 27, 2021 14:55
@qw4990
Copy link
Contributor

qw4990 commented Jan 27, 2021

/run-all-tests

1 similar comment
@qw4990
Copy link
Contributor

qw4990 commented Jan 27, 2021

/run-all-tests

@qw4990
Copy link
Contributor

qw4990 commented Jan 27, 2021

/run-common-test

@qw4990
Copy link
Contributor

qw4990 commented Jan 27, 2021

�/run-all-tests

@qw4990
Copy link
Contributor

qw4990 commented Jan 27, 2021

/run-common-test

@qw4990
Copy link
Contributor

qw4990 commented Jan 28, 2021

/run-all-tests

@qw4990
Copy link
Contributor

qw4990 commented Jan 28, 2021

/run-all-tests

@qw4990
Copy link
Contributor

qw4990 commented Jan 28, 2021

/run-all-tests

@qw4990
Copy link
Contributor

qw4990 commented Jan 28, 2021

/run-all-tests

@qw4990
Copy link
Contributor

qw4990 commented Jan 29, 2021

/run-all-tests

@qw4990
Copy link
Contributor

qw4990 commented Jan 29, 2021

It seems this PR triggers some bugs about prepared-stmt:

INSERT INTO `users` (`age`,`user_num`,`name`,`birthday`,`created_at`,`updated_at`,`billing_address_id`,`shipping_address_id`,`latitude`,`company_id`,`role`,`password_hash`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?) 
[arguments: (1, 0, OrderPluckUser1, 0000-00-00, 2021-01-29 07:26:24.815707, 2021-01-29 07:26:24.815707, NULL, 0, 0, 0, , NULL)]"] 
[txn_mode=OPTIMISTIC] 
[err="[table:1366]Incorrect timestamp value: '0000-00-00' for column 'birthday' at row 1
github.com/pingcap/errors.AddStack
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20201126102027-b0a155152ca3/errors.go:174
github.com/pingcap/errors.(*Error).GenWithStackByArgs
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20201126102027-b0a155152ca3/normalize.go:156
github.com/pingcap/tidb/executor.(*InsertValues).handleErr
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/executor/insert_common.go:300
github.com/pingcap/tidb/executor.(*InsertValues).fastEvalRow
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/executor/insert_common.go:364
github.com/pingcap/tidb/executor.insertRows
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/executor/insert_common.go:232
github.com/pingcap/tidb/executor.(*InsertExec).Next
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/executor/insert.go:288
github.com/pingcap/tidb/executor.Next
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/executor/executor.go:262
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelayExecutor
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/executor/adapter.go:531
github.com/pingcap/tidb/executor.(*ExecStmt).handleNoDelay
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/executor/adapter.go:413
github.com/pingcap/tidb/executor.(*ExecStmt).Exec
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/executor/adapter.go:366
github.com/pingcap/tidb/session.runStmt
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/session/tidb.go:308
github.com/pingcap/tidb/session.(*session).CommonExec
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/session/session.go:1313
github.com/pingcap/tidb/session.(*session).ExecutePreparedStmt
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/session/session.go:1431
github.com/pingcap/tidb/server.(*TiDBStatement).Execute
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/server/driver_tidb.go:77
github.com/pingcap/tidb/server.(*clientConn).handleStmtExecute
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/server/conn_stmt.go:189
github.com/pingcap/tidb/server.(*clientConn).dispatch
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/server/conn.go:1022
github.com/pingcap/tidb/server.(*clientConn).Run
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/server/conn.go:782
github.com/pingcap/tidb/server.(*Server).onConn
	/home/jenkins/agent/workspace/tidb_ghpr_build/go/src/github.com/pingcap/tidb/server/server.go:449
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357
INSERT INTO `users` (`age`,`user_num`,`name`,`birthday`,`created_at`,`updated_at`,`billing_address_id`,`shipping_address_id`,`latitude`,`company_id`,`role`,`password_hash`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?) [arguments: (1, 0, OrderPluckUser1, 0000-00-00, 2021-01-29 07:26:24.815707, 2021-01-29 07:26:24.815707, NULL, 0, 0, 0, , NULL)]

@qw4990
Copy link
Contributor

qw4990 commented Jan 29, 2021

/run-all-tests tidb-test=pr/1160

Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 29, 2021
@qw4990 qw4990 merged commit 9a904e1 into pingcap:release-4.0 Jan 29, 2021
@kennytm kennytm deleted the release-4.0-afb2ab95f07a branch January 25, 2024 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression contribution This PR is from a community contributor. sig/execution SIG execution sig/sql-infra SIG: SQL Infra status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug. type/4.0-cherry-pick
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants