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

session: add default_week_format to builtinGlobalVariable #21511

Merged
merged 3 commits into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2209,6 +2209,7 @@ var builtinGlobalVariable = []string{
variable.InnodbLockWaitTimeout,
variable.WindowingUseHighPrecision,
variable.SQLSelectLimit,
variable.DefaultWeekFormat,

/* TiDB specific global variables: */
variable.TiDBSkipASCIICheck,
Expand Down
10 changes: 10 additions & 0 deletions session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3816,3 +3816,13 @@ func (s *testSessionSerialSuite) TestCoprocessorOOMAction(c *C) {
se.Close()
}
}

// TestDefaultWeekFormat checks for issue #21510.
func (s *testSessionSerialSuite) TestDefaultWeekFormat(c *C) {
tk1 := testkit.NewTestKitWithInit(c, s.store)
tk1.MustExec("set @@global.default_week_format = 4;")
defer tk1.MustExec("set @@global.default_week_format = default;")

tk2 := testkit.NewTestKitWithInit(c, s.store)
tk2.MustQuery("select week('2020-02-02'), @@default_week_format, week('2020-02-02');").Check(testkit.Rows("6 4 6"))
}