@@ -120,6 +120,99 @@ type ScriptTestAssertion struct {
120120// Unlike other engine tests, ScriptTests must be self-contained. No other tables are created outside the definition of
121121// the tests.
122122var ScriptTests = []ScriptTest {
123+ {
124+ // https://github.com/dolthub/dolt/issues/9836
125+ Skip : true ,
126+ Name : "Ordering by pk does not change the order of results" ,
127+ SetUpScript : []string {
128+ "CREATE TABLE test(pk VARCHAR(50) PRIMARY KEY)" ,
129+ "INSERT INTO test VALUES (' 3 12 4'), ('3. 12 4'), ('3.2 12 4'), ('-3.1234'), ('-3.1a'), ('-5+8'), ('+3.1234')" ,
130+ },
131+ Assertions : []ScriptTestAssertion {
132+ {
133+ Query : "SELECT pk FROM test ORDER BY pk" ,
134+ Expected : []sql.Row {{" 3 12 4" }, {"-3.1234" }, {"-3.1a" }, {"-5+8" }, {"+3.1234" }, {"3. 12 4" }, {"3.2 12 4" }},
135+ },
136+ },
137+ },
138+ {
139+ // https://github.com/dolthub/dolt/issues/9812
140+ Name : "String-to-number comparison operators should behave consistently" ,
141+ Assertions : []ScriptTestAssertion {
142+ {
143+ Dialect : "mysql" ,
144+ Query : "SELECT ('A') = (0)" ,
145+ Expected : []sql.Row {{true }},
146+ //ExpectedWarningsCount: 1,
147+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
148+ //ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
149+ },
150+ {
151+ Dialect : "mysql" ,
152+ Query : "SELECT ('A') IN (0)" ,
153+ Expected : []sql.Row {{true }},
154+ //ExpectedWarningsCount: 1,
155+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
156+ //ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
157+ },
158+ {
159+ Dialect : "mysql" ,
160+ Query : "SELECT ('A') != (0)" ,
161+ Expected : []sql.Row {{false }},
162+ //ExpectedWarningsCount: 1,
163+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
164+ //ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
165+ },
166+ {
167+ Dialect : "mysql" ,
168+ Query : "SELECT ('A') <> (0)" ,
169+ Expected : []sql.Row {{false }},
170+ //ExpectedWarningsCount: 1,
171+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
172+ //ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
173+ },
174+ {
175+ Dialect : "mysql" ,
176+ Query : "SELECT ('A') < (0)" ,
177+ Expected : []sql.Row {{false }},
178+ //ExpectedWarningsCount: 1,
179+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
180+ //ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
181+ },
182+ {
183+ Dialect : "mysql" ,
184+ Query : "SELECT ('A') <= (0)" ,
185+ Expected : []sql.Row {{true }},
186+ //ExpectedWarningsCount: 1,
187+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
188+ //ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
189+ },
190+ {
191+ Dialect : "mysql" ,
192+ Query : "SELECT ('A') > (0)" ,
193+ Expected : []sql.Row {{false }},
194+ //ExpectedWarningsCount: 1,
195+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
196+ //ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
197+ },
198+ {
199+ Dialect : "mysql" ,
200+ Query : "SELECT ('A') >= (0)" ,
201+ Expected : []sql.Row {{true }},
202+ //ExpectedWarningsCount: 1,
203+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
204+ //ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
205+ },
206+ {
207+ Dialect : "mysql" ,
208+ Query : "SELECT ('A') NOT IN (0)" ,
209+ Expected : []sql.Row {{false }},
210+ //ExpectedWarningsCount: 1,
211+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
212+ //ExpectedWarningMessageSubstring: "Truncated incorrect double value: A",
213+ },
214+ },
215+ },
123216 {
124217 // https://github.com/dolthub/dolt/issues/9794
125218 Name : "UPDATE with TRIM function on TEXT column" ,
@@ -11662,6 +11755,8 @@ select * from t1 except (
1166211755 {"5.932887e7abc" , float32 (5.932887e+07 )},
1166311756 {"a1a1" , float32 (0 )},
1166411757 },
11758+ //ExpectedWarningsCount: 12,
11759+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1166511760 },
1166611761 {
1166711762 Dialect : "mysql" ,
@@ -11686,6 +11781,8 @@ select * from t1 except (
1168611781 {"5.932887e7abc" , 5.932887e+07 },
1168711782 {"a1a1" , 0.0 },
1168811783 },
11784+ //ExpectedWarningsCount: 12,
11785+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1168911786 },
1169011787 {
1169111788 Dialect : "mysql" ,
@@ -11710,6 +11807,8 @@ select * from t1 except (
1171011807 {"5.932887e7abc" , 5 },
1171111808 {"a1a1" , 0 },
1171211809 },
11810+ //ExpectedWarningsCount: 12,
11811+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1171311812 },
1171411813 {
1171511814 Dialect : "mysql" ,
@@ -11734,6 +11833,8 @@ select * from t1 except (
1173411833 {"5.932887e7abc" , uint64 (5 )},
1173511834 {"a1a1" , uint64 (0 )},
1173611835 },
11836+ //ExpectedWarningsCount: 19,
11837+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1173711838 },
1173811839 {
1173911840 Dialect : "mysql" ,
@@ -11758,10 +11859,13 @@ select * from t1 except (
1175811859 {"5.932887e7abc" , "59328870.000" },
1175911860 {"a1a1" , "0.000" },
1176011861 },
11862+ //ExpectedWarningsCount: 13,
11863+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1176111864 },
1176211865 {
1176311866 Query : "select * from test01 where pk in ('11')" ,
1176411867 Expected : []sql.Row {{"11" }},
11868+ //ExpectedWarningsCount: 0,
1176511869 },
1176611870 {
1176711871 // https://github.com/dolthub/dolt/issues/9739
@@ -11774,6 +11878,8 @@ select * from t1 except (
1177411878 {"11d" },
1177511879 {"11wha?" },
1177611880 },
11881+ //ExpectedWarningsCount: 12,
11882+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1177711883 },
1177811884 {
1177911885 // https://github.com/dolthub/dolt/issues/9739
@@ -11785,6 +11891,8 @@ select * from t1 except (
1178511891 {" 3. 12 4" },
1178611892 {"3. 12 4" },
1178711893 },
11894+ //ExpectedWarningsCount: 12,
11895+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1178811896 },
1178911897 {
1179011898 // https://github.com/dolthub/dolt/issues/9739
@@ -11798,20 +11906,26 @@ select * from t1 except (
1179811906 {"+3.1234" },
1179911907 {"3. 12 4" },
1180011908 },
11909+ //ExpectedWarningsCount: 20,
11910+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1180111911 },
1180211912 {
1180311913 // https://github.com/dolthub/dolt/issues/9739
1180411914 Skip : true ,
1180511915 Dialect : "mysql" ,
1180611916 Query : "select * from test02 where pk in ('11asdf')" ,
1180711917 Expected : []sql.Row {{"11" }},
11918+ //ExpectedWarningsCount: 1,
11919+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1180811920 },
1180911921 {
1181011922 // https://github.com/dolthub/dolt/issues/9739
1181111923 Skip : true ,
1181211924 Dialect : "mysql" ,
1181311925 Query : "select * from test02 where pk='11.12asdf'" ,
1181411926 Expected : []sql.Row {},
11927+ //ExpectedWarningsCount: 1,
11928+ //ExpectedWarning: mysql.ERTruncatedWrongValue,
1181511929 },
1181611930 },
1181711931 },
0 commit comments