Skip to content

Commit 160be11

Browse files
committed
add test for setting time zone from table value
1 parent 210a23c commit 160be11

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

enginetest/queries/time_queries.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,25 @@ var TimeQueryTests = []ScriptTest{
5959
},
6060
},
6161
},
62+
{
63+
Name: "set time zone from table value",
64+
SetUpScript: []string{
65+
"create table timezones(pk int primary key, tz varchar(20))",
66+
"insert into timezones values (1, 'invalid time zone'), (2, '-5:00')",
67+
},
68+
Assertions: []ScriptTestAssertion{
69+
{
70+
Query: "set time_zone=(select tz from timezones where pk = 1)",
71+
ExpectedErr: sql.ErrInvalidTimeZone,
72+
},
73+
{
74+
Query: "set time_zone=(select tz from timezones where pk = 2)",
75+
Expected: []sql.Row{{types.NewOkResult(0)}},
76+
},
77+
{
78+
Query: "select now()",
79+
Expected: []sql.Row{{time.Date(2025, time.July, 23, 11, 43, 21, 0, time.UTC)}},
80+
},
81+
},
82+
},
6283
}

0 commit comments

Comments
 (0)