@@ -1846,14 +1846,16 @@ var FunctionQueryTests = []QueryTest{
18461846 Expected : []sql.Row {{1 }},
18471847 },
18481848 {
1849- Query : "select dayofweek(0)" ,
1850- Expected : []sql.Row {{nil }},
1851- // MySQL has a warning
1849+ Query : "select dayofweek(0)" ,
1850+ Expected : []sql.Row {{nil }},
1851+ ExpectedWarning : mysql .ERTruncatedWrongValue ,
1852+ ExpectedWarningsCount : 1 ,
18521853 },
18531854 {
1854- Query : "select dayofweek(false)" ,
1855- Expected : []sql.Row {{nil }},
1856- // MySQL has a warning
1855+ Query : "select dayofweek(false)" ,
1856+ Expected : []sql.Row {{nil }},
1857+ ExpectedWarning : mysql .ERTruncatedWrongValue ,
1858+ ExpectedWarningsCount : 1 ,
18571859 },
18581860 {
18591861 Query : "select dayofweek(true)" ,
@@ -1862,9 +1864,10 @@ var FunctionQueryTests = []QueryTest{
18621864 ExpectedWarningsCount : 1 ,
18631865 },
18641866 {
1865- Query : "select dayofweek('0000-00-00')" ,
1866- Expected : []sql.Row {{nil }},
1867- // MySQL has a warning
1867+ Query : "select dayofweek('0000-00-00')" ,
1868+ Expected : []sql.Row {{nil }},
1869+ ExpectedWarning : mysql .ERTruncatedWrongValue ,
1870+ ExpectedWarningsCount : 1 ,
18681871 },
18691872 {
18701873 Query : "select dayofweek('0000-01-01')" ,
@@ -1878,14 +1881,16 @@ var FunctionQueryTests = []QueryTest{
18781881 Expected : []sql.Row {{5 }},
18791882 },
18801883 {
1881- Query : "select dayofyear(0)" ,
1882- Expected : []sql.Row {{nil }},
1883- // MySQL has a warning
1884+ Query : "select dayofyear(0)" ,
1885+ Expected : []sql.Row {{nil }},
1886+ ExpectedWarning : mysql .ERTruncatedWrongValue ,
1887+ ExpectedWarningsCount : 1 ,
18841888 },
18851889 {
1886- Query : "select dayofyear(false)" ,
1887- Expected : []sql.Row {{nil }},
1888- // MySQL has a warning
1890+ Query : "select dayofyear(false)" ,
1891+ Expected : []sql.Row {{nil }},
1892+ ExpectedWarning : mysql .ERTruncatedWrongValue ,
1893+ ExpectedWarningsCount : 1 ,
18891894 },
18901895 {
18911896 Query : "select dayofyear(true)" ,
@@ -1894,9 +1899,10 @@ var FunctionQueryTests = []QueryTest{
18941899 ExpectedWarningsCount : 1 ,
18951900 },
18961901 {
1897- Query : "select dayofyear('0000-00-00')" ,
1898- Expected : []sql.Row {{nil }},
1899- // MySQL has a warning
1902+ Query : "select dayofyear('0000-00-00')" ,
1903+ Expected : []sql.Row {{nil }},
1904+ ExpectedWarning : mysql .ERTruncatedWrongValue ,
1905+ ExpectedWarningsCount : 1 ,
19001906 },
19011907 {
19021908 Query : "select dayofyear('0000-01-01')" ,
@@ -2006,8 +2012,15 @@ var FunctionQueryTests = []QueryTest{
20062012 ExpectedWarningsCount : 1 ,
20072013 },
20082014 {
2009- Query : "select weekday('0000-01-01')" ,
2010- Expected : []sql.Row {{6 }},
2015+ Query : "select weekday('0000-01-01')" ,
2016+ // This is 6 (Sunday) in MySQL. It seems like Go's time library considers 0000-02-29 a valid date but MySQL does
2017+ // not. This is why the days of the week are off. 0000 is not a real year anyway. This test is to make sure
2018+ // 0000-01-01 is not interpreted as zero time
2019+ Expected : []sql.Row {{5 }},
2020+ },
2021+ {
2022+ Query : "select weekday('2025-11-13')" ,
2023+ Expected : []sql.Row {{3 }},
20112024 },
20122025 {
20132026 Query : "select weekofyear(0)" ,
0 commit comments