Skip to content

Commit

Permalink
Add REAL, DEC, and FIXED to SQLType()
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktobey committed Dec 1, 2023
1 parent 75ae711 commit 94f5476
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -2919,8 +2919,14 @@ func (ct *ColumnType) SQLType() querypb.Type {
return sqltypes.Float32
case keywordStrings[DOUBLE]:
return sqltypes.Float64
case keywordStrings[REAL]:
return sqltypes.Float64
case keywordStrings[DECIMAL]:
return sqltypes.Decimal
case keywordStrings[DEC]:
return sqltypes.Decimal
case keywordStrings[FIXED]:
return sqltypes.Decimal
case keywordStrings[BIT]:
return sqltypes.Bit
case keywordStrings[ENUM]:
Expand Down
9 changes: 9 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6776,6 +6776,15 @@ var (
}, {
input: "create table t (id int primary key, col1 FLOAT SRID 0)",
output: "cannot define SRID for non spatial types at position 55 near '0'",
}, {
input: "create table t (id int primary key, col1 REAL SRID 0)",
output: "cannot define SRID for non spatial types at position 54 near '0'",
}, {
input: "create table t (id int primary key, col1 DEC(34, 2) SRID 0)",
output: "cannot define SRID for non spatial types at position 60 near '0'",
}, {
input: "create table t (id int primary key, col1 FIXED(4, 4) SRID 0)",
output: "cannot define SRID for non spatial types at position 61 near '0'",
}, {
input: "create table t (id int primary key, col1 geometry SRID -1)",
output: "syntax error at position 57 near 'SRID'",
Expand Down

0 comments on commit 94f5476

Please sign in to comment.