Skip to content

Commit

Permalink
fix case use mysql test
Browse files Browse the repository at this point in the history
Signed-off-by: guo-shaoge <shaoge1994@163.com>
  • Loading branch information
guo-shaoge committed Sep 27, 2023
1 parent 8a5e23a commit 2db9112
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
12 changes: 0 additions & 12 deletions expression/integration_test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2059,15 +2059,3 @@ func TestIssue41986(t *testing.T) {
// shouldn't report they can't find column error and return the right result.
tk.MustQuery("SELECT GROUP_CONCAT(effective_date order by stlmnt_hour DESC) FROM ( SELECT (COALESCE(pct.clearing_time, 0)/3600000) AS stlmnt_hour ,COALESCE(pct.effective_date, '1970-01-01 08:00:00') AS effective_date FROM poi_clearing_time_topic pct ORDER BY pct.effective_date DESC ) a;").Check(testkit.Rows("2023-08-25 00:00:00"))
}

func TestCastErrMsg(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)

tk.MustExec("use test")
tk.MustExec("drop table if exists t1;")
tk.MustExec("CREATE TABLE t1 (c1 TEXT);")
tk.MustExec("INSERT INTO t1 VALUES ('a');")
err := tk.ExecToErr("UPDATE t1 SET c1 = CAST('61QW' AS DECIMAL);")
require.Contains(t, err.Error(), "Truncated incorrect DECIMAL value: '61QW'")
}
10 changes: 10 additions & 0 deletions tests/integrationtest/r/expression/cast.result
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,13 @@ select cast(col4 as time(31)) from t where col1 is null;
Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6.
select cast(col5 as time(31)) from t where col1 is null;
Error 1426 (42000): Too big precision 31 specified for column 'CAST'. Maximum is 6.
drop table if exists t1;
create table t1 (c1 text);
insert into t1 values ('a');
update t1 set c1 = cast('61qw' as decimal);
Error 1292 (22007): Truncated incorrect DECIMAL value: '61qw'
select cast('61qw' as decimal);
cast('61qw' as decimal)
61
Level Code Message
Warning 1292 Truncated incorrect DECIMAL value: '61qw'
10 changes: 10 additions & 0 deletions tests/integrationtest/t/expression/cast.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,13 @@ select cast(col3 as time(31)) from t where col1 is null;
select cast(col4 as time(31)) from t where col1 is null;
-- error 1426
select cast(col5 as time(31)) from t where col1 is null;

# TestCastErrMsg
drop table if exists t1;
create table t1 (c1 text);
insert into t1 values ('a');
--error 1292
update t1 set c1 = cast('61qw' as decimal);
--enable_warnings
select cast('61qw' as decimal);
--disable_warnings

0 comments on commit 2db9112

Please sign in to comment.