fix #200. Select query shouldn't fail if time was among the selected columns
parent
1338121ed8
commit
ad3a24db32
|
@ -198,5 +198,6 @@
|
|||
### Bugfixes
|
||||
|
||||
- [Issue #195](https://github.com/influxdb/influxdb/issues/195). Allow the bind address to be configurable, Thanks @schmurfy.
|
||||
- [Issue #200](https://github.com/influxdb/influxdb/issues/200). Selecting `time` or `sequence_number` silently fail
|
||||
|
||||
### Deprecated
|
||||
|
|
|
@ -322,6 +322,24 @@ func (self *ServerSuite) TestListSeries(c *C) {
|
|||
}
|
||||
}
|
||||
|
||||
func (self *ServerSuite) TestSelectingTimeColumn(c *C) {
|
||||
self.serverProcesses[0].Post("/db?u=root&p=root", `{"name": "test_rep", "replicationFactor": 2}`, c)
|
||||
self.serverProcesses[0].Post("/db/test_rep/users?u=root&p=root", `{"name": "paul", "password": "pass"}`, c)
|
||||
time.Sleep(time.Second)
|
||||
data := `[{
|
||||
"name": "selecting_time_column",
|
||||
"columns": ["val1"],
|
||||
"points": [[1]]
|
||||
}]`
|
||||
self.serverProcesses[0].Post("/db/test_rep/series?u=paul&p=pass", data, c)
|
||||
for _, s := range self.serverProcesses {
|
||||
collection := s.Query("test_rep", "select val1, time from selecting_time_column", false, c)
|
||||
s := collection.GetSeries("selecting_time_column", c)
|
||||
c.Assert(s.Columns, HasLen, 3)
|
||||
c.Assert(s.Points, HasLen, 1)
|
||||
}
|
||||
}
|
||||
|
||||
func (self *ServerSuite) TestDropDatabase(c *C) {
|
||||
self.serverProcesses[0].Post("/db?u=root&p=root", `{"name": "drop_db", "replicationFactor": 3}`, c)
|
||||
self.serverProcesses[0].Post("/db/drop_db/users?u=root&p=root", `{"name": "paul", "password": "pass"}`, c)
|
||||
|
|
|
@ -179,7 +179,7 @@ func (self *QueryParserSuite) TestParseDeleteQuery(c *C) {
|
|||
}
|
||||
|
||||
func (self *QueryParserSuite) TestParseWithUnderscore(c *C) {
|
||||
queryString := "select _value from foo"
|
||||
queryString := "select _value, time, sequence_number from foo"
|
||||
query, err := ParseSelectQuery(queryString)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
|
|
|
@ -113,6 +113,9 @@ func (self *SelectQuery) GetReferencedColumns() map[*Value][]string {
|
|||
|
||||
notPrefixedColumns := []string{}
|
||||
for _, value := range self.GetColumnNames() {
|
||||
if value.Name == "time" || value.Name == "sequence_number" {
|
||||
continue
|
||||
}
|
||||
notPrefixedColumns = append(notPrefixedColumns, getReferencedColumnsFromValue(value, mapping)...)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue