Skip to content

Commit

Permalink
sql: Adding support for integral aliases.
Browse files Browse the repository at this point in the history
Before this patch we would discard more precise type informations for types
such as INT8 and INT64. SHOW CREATE TABLE would show INT even if the user
specified either of those.

After this patch we'll save this information. SHOW CREATE TABLE will now
display the correct type.
  • Loading branch information
Masha Schneider committed Jun 16, 2017
1 parent e968655 commit f6e4592
Show file tree
Hide file tree
Showing 5 changed files with 233 additions and 146 deletions.
4 changes: 2 additions & 2 deletions pkg/sql/logictest/testdata/logic_test/table
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ SHOW COLUMNS FROM test.alltypes
Field Type Null Default Indices
a BOOL true NULL {}
b INT true NULL {}
c INT true NULL {}
d INT true NULL {}
c INT8 true NULL {}
d INT64 true NULL {}
e INT true NULL {}
f INT true NULL {}
g INT true NULL {}
Expand Down
3 changes: 3 additions & 0 deletions pkg/sql/sqlbase/structured.go
Original file line number Diff line number Diff line change
Expand Up @@ -1742,6 +1742,9 @@ func (c *ColumnType) SQLString() string {
case ColumnType_INT_ARRAY:
return "INT[]"
}
if c.Alias != ColumnType_NONE {
return c.Alias.String()
}
return c.Kind.String()
}

Expand Down
Loading

0 comments on commit f6e4592

Please sign in to comment.