Added some skipped tests for type conversion errors on column modify

This commit is contained in:
Zach Musgrave
2022-06-02 11:02:13 -07:00
parent 9a49ed2436
commit ca8b4180f2
2 changed files with 26 additions and 8 deletions
@@ -644,4 +644,30 @@ var BrokenDDLScripts = []queries.ScriptTest{
},
},
},
{
Name: "alter string column to truncate data",
SetUpScript: []string{
"create table t1 (a int primary key, b varchar(3))",
"insert into t1 values (1, 'hi'), (2, 'bye')",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "alter table t1 modify b varchar(2)",
ExpectedErr: sql.ErrInvalidValue, // not sure of the type of error, but it should give one
},
},
},
{
Name: "alter datetime column with invalid values",
SetUpScript: []string{
"CREATE TABLE t3(pk BIGINT PRIMARY KEY, v1 DATETIME, INDEX(v1))",
"INSERT INTO t3 VALUES (0,'1999-11-02 17:39:38'),(1,'3021-01-08 02:59:27');",
},
Assertions: []queries.ScriptTestAssertion{
{
Query: "alter table t3 modify v1 timestamp",
ExpectedErr: sql.ErrInvalidValue, // not sure of the type of error, but it should give one
},
},
},
}
-8
View File
@@ -1026,18 +1026,10 @@ SQL
skip_nbf_dolt_1
dolt sql <<SQL
CREATE TABLE t1(pk BIGINT PRIMARY KEY, v1 INT, INDEX(v1));
CREATE TABLE t2(pk BIGINT PRIMARY KEY, v1 VARCHAR(20), INDEX(v1));
CREATE TABLE t3(pk BIGINT PRIMARY KEY, v1 DATETIME, INDEX(v1));
INSERT INTO t1 VALUES (0,-1),(1,1);
INSERT INTO t2 VALUES (0,'hi'),(1,'bye');
INSERT INTO t3 VALUES (0,'1999-11-02 17:39:38'),(1,'3021-01-08 02:59:27');
SQL
run dolt sql -q "ALTER TABLE t1 MODIFY COLUMN v1 INT UNSIGNED"
[ "$status" -eq "1" ]
run dolt sql -q "ALTER TABLE t2 MODIFY COLUMN v1 VARCHAR(2)"
[ "$status" -eq "1" ]
run dolt sql -q "ALTER TABLE t3 MODIFY COLUMN v1 TIMESTAMP"
[ "$status" -eq "1" ]
}
@test "sql: alter table modify column type no data change" {