Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

sql: information schema column types should be lowercase #851

Merged
merged 1 commit into from
Oct 22, 2019
Merged
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
17 changes: 8 additions & 9 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/src-d/go-mysql-server/sql/plan"
"github.com/src-d/go-mysql-server/test"


"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -867,8 +866,8 @@ var queries = []struct {
WHERE TABLE_SCHEMA='mydb' AND TABLE_NAME='mytable'
`,
[]sql.Row{
{"s", "TEXT"},
{"i", "BIGINT"},
{"s", "text"},
{"i", "bigint"},
},
},
{
Expand Down Expand Up @@ -2250,8 +2249,8 @@ func TestUpdate(t *testing.T) {
var updates = []struct {
updateQuery string
expectedUpdate []sql.Row
selectQuery string
expectedSelect []sql.Row
selectQuery string
expectedSelect []sql.Row
}{
{
"UPDATE mytable SET s = 'updated';",
Expand All @@ -2275,7 +2274,7 @@ func TestUpdate(t *testing.T) {
"UPDATE mytable SET s = 'updated' WHERE i <> 9999;",
[]sql.Row{{int64(3), int64(3)}},
"SELECT * FROM mytable;",
[]sql.Row{{int64(1), "updated"},{int64(2), "updated"},{int64(3), "updated"}},
[]sql.Row{{int64(1), "updated"}, {int64(2), "updated"}, {int64(3), "updated"}},
},
{
"UPDATE floattable SET f32 = f32 + f32, f64 = f32 * f64 WHERE i = 2;",
Expand Down Expand Up @@ -2477,7 +2476,7 @@ func TestCreateTable(t *testing.T) {

testQuery(t, e,
"CREATE TABLE t2 (a INTEGER NOT NULL PRIMARY KEY, "+
"b VARCHAR(10) NOT NULL)",
"b VARCHAR(10) NOT NULL)",
[]sql.Row(nil),
)

Expand All @@ -2496,8 +2495,8 @@ func TestCreateTable(t *testing.T) {

testQuery(t, e,
"CREATE TABLE t3(a INTEGER NOT NULL,"+
"b TEXT NOT NULL,"+
"c bool, primary key (a,b))",
"b TEXT NOT NULL,"+
"c bool, primary key (a,b))",
[]sql.Row(nil),
)

Expand Down
43 changes: 22 additions & 21 deletions sql/information_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"io"
"strings"
)

const (
Expand Down Expand Up @@ -214,27 +215,27 @@ func columnsRowIter(cat *Catalog) RowIter {
collName = "utf8_bin"
}
rows = append(rows, Row{
"def", // table_catalog
db.Name(), // table_schema
t.Name(), // table_name
c.Name, // column_name
uint64(i), // ordinal_position
c.Default, // column_default
nullable, // is_nullable
MySQLTypeName(c.Type), // data_type
nil, // character_maximum_length
nil, // character_octet_length
nil, // numeric_precision
nil, // numeric_scale
nil, // datetime_precision
charName, // character_set_name
collName, // collation_name
MySQLTypeName(c.Type), // column_type
"", // column_key
"", // extra
"select", // privileges
"", // column_comment
"", // generation_expression
"def", // table_catalog
db.Name(), // table_schema
t.Name(), // table_name
c.Name, // column_name
uint64(i), // ordinal_position
c.Default, // column_default
nullable, // is_nullable
strings.ToLower(MySQLTypeName(c.Type)), // data_type
nil, // character_maximum_length
nil, // character_octet_length
nil, // numeric_precision
nil, // numeric_scale
nil, // datetime_precision
charName, // character_set_name
collName, // collation_name
strings.ToLower(MySQLTypeName(c.Type)), // column_type
"", // column_key
"", // extra
"select", // privileges
"", // column_comment
"", // generation_expression
})
}
}
Expand Down