Skip to content

dolthub/dolt#9606 - Fix ALTER TABLE MODIFY COLUMN row count reporting #3132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion enginetest/enginetests.go
Original file line number Diff line number Diff line change
Expand Up @@ -3145,7 +3145,7 @@ func TestModifyColumn(t *testing.T, harness Harness) {
se.NewConnection(ctx)
}
TestQueryWithContext(t, ctx, e, harness, "select database()", []sql.Row{{nil}}, nil, nil, nil)
TestQueryWithContext(t, ctx, e, harness, "ALTER TABLE mydb.mytable MODIFY COLUMN s VARCHAR(21) NULL COMMENT 'changed again'", []sql.Row{{types.NewOkResult(0)}}, nil, nil, nil)
TestQueryWithContext(t, ctx, e, harness, "ALTER TABLE mydb.mytable MODIFY COLUMN s VARCHAR(21) NULL COMMENT 'changed again'", []sql.Row{{types.NewOkResult(4)}}, nil, nil, nil)
TestQueryWithContext(t, ctx, e, harness, "SHOW FULL COLUMNS FROM mydb.mytable", []sql.Row{
{"i", "bigint", nil, "NO", "PRI", nil, "", "", "ok"},
{"s", "varchar(21)", "utf8mb4_0900_bin", "YES", "", nil, "", "", "changed again"},
Expand Down
28 changes: 14 additions & 14 deletions enginetest/queries/alter_table_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ var AlterTableScripts = []ScriptTest{
Assertions: []ScriptTestAssertion{
{
Query: "ALTER TABLE t40 MODIFY COLUMN pk int",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(3)}},
},
{
Query: "describe t40",
Expand Down Expand Up @@ -1091,7 +1091,7 @@ var AlterTableScripts = []ScriptTest{
Assertions: []ScriptTestAssertion{
{
Query: `alter table t modify column c1 int unsigned`,
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(1)}},
},
{
Query: "describe t;",
Expand Down Expand Up @@ -1156,7 +1156,7 @@ var AlterTableScripts = []ScriptTest{
{
Query: "alter table t modify column e enum('c', 'a', 'b');",
Expected: []sql.Row{
{types.NewOkResult(0)},
{types.NewOkResult(4)},
},
},
{
Expand All @@ -1171,7 +1171,7 @@ var AlterTableScripts = []ScriptTest{
{
Query: "alter table t modify column e enum('asdf', 'a', 'b', 'c');",
Expected: []sql.Row{
{types.NewOkResult(0)},
{types.NewOkResult(4)},
},
},
{
Expand All @@ -1186,7 +1186,7 @@ var AlterTableScripts = []ScriptTest{
{
Query: "alter table t modify column e enum('asdf', 'a', 'b', 'c', 'd');",
Expected: []sql.Row{
{types.NewOkResult(0)},
{types.NewOkResult(4)},
},
},
{
Expand All @@ -1201,7 +1201,7 @@ var AlterTableScripts = []ScriptTest{
{
Query: "alter table t modify column e enum('a', 'b', 'c');",
Expected: []sql.Row{
{types.NewOkResult(0)},
{types.NewOkResult(4)},
},
},
{
Expand Down Expand Up @@ -1244,7 +1244,7 @@ var AlterTableScripts = []ScriptTest{
{
Query: "alter table t modify column s set('a', 'b', 'c', 'd');",
Expected: []sql.Row{
{types.NewOkResult(0)},
{types.NewOkResult(8)},
},
},
{
Expand Down Expand Up @@ -2166,7 +2166,7 @@ var ModifyColumnScripts = []ScriptTest{
Assertions: []ScriptTestAssertion{
{
Query: "ALTER TABLE mytable MODIFY COLUMN i bigint NOT NULL COMMENT 'modified'",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(3)}},
},
{
Query: "SHOW FULL COLUMNS FROM mytable /* 1 */",
Expand All @@ -2177,7 +2177,7 @@ var ModifyColumnScripts = []ScriptTest{
},
{
Query: "ALTER TABLE mytable MODIFY COLUMN i TINYINT NOT NULL COMMENT 'yes' AFTER s",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(3)}},
},
{
Query: "SHOW FULL COLUMNS FROM mytable /* 2 */",
Expand All @@ -2188,7 +2188,7 @@ var ModifyColumnScripts = []ScriptTest{
},
{
Query: "ALTER TABLE mytable MODIFY COLUMN i BIGINT NOT NULL COMMENT 'ok' FIRST",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(3)}},
},
{
Query: "SHOW FULL COLUMNS FROM mytable /* 3 */",
Expand All @@ -2199,7 +2199,7 @@ var ModifyColumnScripts = []ScriptTest{
},
{
Query: "ALTER TABLE mytable MODIFY COLUMN s VARCHAR(20) NULL COMMENT 'changed'",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(3)}},
},
{
Query: "SHOW FULL COLUMNS FROM mytable /* 4 */",
Expand All @@ -2216,7 +2216,7 @@ var ModifyColumnScripts = []ScriptTest{
Assertions: []ScriptTestAssertion{
{
Query: "ALTER TABLE mytable MODIFY i BIGINT auto_increment",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(3)}},
},
{
Query: "SHOW FULL COLUMNS FROM mytable /* 1 */",
Expand Down Expand Up @@ -2249,7 +2249,7 @@ var ModifyColumnScripts = []ScriptTest{
},
{
Query: "ALTER TABLE mytable MODIFY COLUMN i BIGINT NOT NULL COMMENT 'ok' FIRST",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(4)}},
},
{
Query: "SHOW FULL COLUMNS FROM mytable /* 3 */",
Expand All @@ -2261,7 +2261,7 @@ var ModifyColumnScripts = []ScriptTest{
},
{
Query: "ALTER TABLE mytable MODIFY COLUMN s VARCHAR(20) NULL COMMENT 'changed'",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(4)}},
},
{
Query: "SHOW FULL COLUMNS FROM mytable /* 4 */",
Expand Down
4 changes: 2 additions & 2 deletions enginetest/queries/charset_collation_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ var CharsetCollationEngineTests = []CharsetCollationEngineTest{
{
Query: "ALTER TABLE test2 MODIFY COLUMN v1 VARCHAR(100);",
Expected: []sql.Row{
{types.NewOkResult(0)},
{types.NewOkResult(4)},
},
},
{
Expand Down Expand Up @@ -342,7 +342,7 @@ var CharsetCollationEngineTests = []CharsetCollationEngineTest{
{
Query: "ALTER TABLE test2 CHANGE COLUMN v1 v1 VARCHAR(220);",
Expected: []sql.Row{
{types.NewOkResult(0)},
{types.NewOkResult(4)},
},
},
{
Expand Down
8 changes: 4 additions & 4 deletions enginetest/queries/foreign_key_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,11 @@ var ForeignKeyTests = []ScriptTest{
},
{
Query: "ALTER TABLE parent2 MODIFY v1 VARCHAR(30);",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(2)}},
},
{
Query: "ALTER TABLE child2 MODIFY v1 VARCHAR(30);",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(1)}},
},
{
Query: "ALTER TABLE parent3 MODIFY v1 BINARY(30);",
Expand Down Expand Up @@ -564,11 +564,11 @@ var ForeignKeyTests = []ScriptTest{
},
{
Query: "ALTER TABLE parent1 MODIFY v2 BIGINT;",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(2)}},
},
{
Query: "ALTER TABLE child1 MODIFY v2 BIGINT;",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(1)}},
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions enginetest/queries/fulltext_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ var FulltextTests = []ScriptTest{
Assertions: []ScriptTestAssertion{
{
Query: "ALTER TABLE test MODIFY COLUMN v3 FLOAT AFTER pk;",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(5)}},
},
{
Query: "SELECT * FROM test WHERE MATCH(v1, v2) AGAINST ('ghi');",
Expand All @@ -751,7 +751,7 @@ var FulltextTests = []ScriptTest{
Assertions: []ScriptTestAssertion{
{
Query: "ALTER TABLE test MODIFY COLUMN v2 TEXT;",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(5)}},
},
{
Query: "SELECT * FROM test WHERE MATCH(v1, v2) AGAINST ('ghi');",
Expand Down
12 changes: 6 additions & 6 deletions enginetest/queries/script_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -3722,7 +3722,7 @@ CREATE TABLE tab3 (
},
{
Query: "ALTER TABLE TEST MODIFY COLUMN pk BIGINT AUTO_INCREMENT, AUTO_INCREMENT = 100",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(1)}},
},
{
Query: "INSERT INTO test (v2) values (11)",
Expand Down Expand Up @@ -11453,7 +11453,7 @@ var SpatialScriptTests = []ScriptTest{
},
{
Query: "ALTER TABLE tab2 CHANGE COLUMN p p POINT NOT NULL",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(1)}},
},
{
Query: "INSERT INTO tab2 VALUES (2, ST_GEOMFROMTEXT(ST_ASWKT(POINT(1, 6)), 4326))",
Expand All @@ -11473,7 +11473,7 @@ var SpatialScriptTests = []ScriptTest{
},
{
Query: "ALTER TABLE tab2 CHANGE COLUMN p p POINT NOT NULL SRID 4326",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(1)}},
},
{
Query: "show create table tab2",
Expand Down Expand Up @@ -11501,7 +11501,7 @@ var SpatialScriptTests = []ScriptTest{
},
{
Query: "ALTER TABLE tab3 MODIFY COLUMN y POLYGON NOT NULL SRID 0",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(1)}},
},
{
Query: "ALTER TABLE tab3 MODIFY COLUMN y POLYGON NOT NULL SRID 4326",
Expand All @@ -11513,7 +11513,7 @@ var SpatialScriptTests = []ScriptTest{
},
{
Query: "ALTER TABLE tab3 MODIFY COLUMN y GEOMETRY NULL SRID 0",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(1)}},
},
{
Query: "select i, ST_ASWKT(y) FROM tab3",
Expand Down Expand Up @@ -11565,7 +11565,7 @@ var SpatialScriptTests = []ScriptTest{
},
{
Query: "ALTER TABLE table1 CHANGE COLUMN p p geometry srid 4326",
Expected: []sql.Row{{types.NewOkResult(0)}},
Expected: []sql.Row{{types.NewOkResult(1)}},
},
{
Query: "show create table table1",
Expand Down
2 changes: 1 addition & 1 deletion enginetest/queries/update_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ var OnUpdateExprScripts = []ScriptTest{
{
Query: "alter table t modify column ts timestamp default 0 on update current_timestamp;",
Expected: []sql.Row{
{types.NewOkResult(0)},
{types.NewOkResult(3)},
},
},
{
Expand Down
Loading
Loading