MCPcopy Create free account
hub / github.com/apecloud/myduckserver / RunModifyColumnTest

Function RunModifyColumnTest

main_test.go:1685–1707  ·  view source on GitHub ↗
(t *testing.T, harness enginetest.Harness)

Source from the content-addressed store, hash-verified

1683 se.NewConnection(ctx)
1684 }
1685 enginetest.TestQueryWithContext(t, ctx, e, harness, "select database()", []sql.Row{{nil}}, nil, nil, nil)
1686 enginetest.TestQueryWithContext(t, ctx, e, harness, "ALTER TABLE mydb.mytable_m1 MODIFY COLUMN s VARCHAR(21) NULL COMMENT 'changed again'", []sql.Row{{types.NewOkResult(0)}}, nil, nil, nil)
1687 enginetest.TestQueryWithContext(t, ctx, e, harness, "SHOW FULL COLUMNS FROM mydb.mytable_m1", []sql.Row{
1688 {"i", "bigint", nil, "NO", "", nil, "", "", "ok"},
1689 {"s", "varchar(21)", "utf8mb4_0900_bin", "YES", "", nil, "", "", "changed again"},
1690 }, nil, nil, nil)
1691 })
1692}
1693
1694func TestDropColumn(t *testing.T) {
1695 queries.DropColumnScripts = []queries.ScriptTest{
1696 {
1697 Name: "drop column",
1698 SetUpScript: []string{
1699 "CREATE TABLE mytable_drop_column (i bigint primary key, s varchar(20))",
1700 "INSERT INTO mytable_drop_column VALUES (1, 'first row'), (2, 'second row'), (3, 'third row')",
1701 "ALTER TABLE mytable_drop_column DROP COLUMN s",
1702 },
1703 Assertions: []queries.ScriptTestAssertion{
1704 {
1705 Query: "SHOW FULL COLUMNS FROM mytable_drop_column",
1706 Expected: []sql.Row{{"i", "bigint", nil, "NO", "PRI", nil, "", "", ""}},
1707 },
1708 {
1709 Query: "select * from mytable_drop_column order by i",
1710 Expected: []sql.Row{{1}, {2}, {3}},

Callers 1

TestModifyColumnFunction · 0.85

Calls 6

mustNewEngineFunction · 0.85
SetupMethod · 0.80
CloseMethod · 0.65
NewContextMethod · 0.65
NewConnectionMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected