mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-05 16:15:56 +00:00
Check "like" argument applied to keyed fields
Check if queries that have a 'like' argument are applied to keyed fields. If not, log that the user is trying to use 'like' on an unsupported field type (as opposed to reporting that there are no results.)
This commit is contained in:
parent
872eb99b9d
commit
05e98ee678
1 changed files with 11 additions and 0 deletions
11
executor.go
11
executor.go
|
|
@ -6731,6 +6731,17 @@ func (e *executor) translateCall(c *pql.Call, index string, columnKeys map[strin
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if "like" argument is applied to keyed fields.
|
||||
if _, found := c.Args["like"].(string); found {
|
||||
fieldName, err := c.FirstStringArg("_field", "field")
|
||||
if err != nil || fieldName == "" {
|
||||
return nil, fmt.Errorf("cannot read field name for Rows call")
|
||||
}
|
||||
if !idx.Field(fieldName).options.Keys {
|
||||
return nil, fmt.Errorf("'%s' is not a set/mutex/time field with a string key", fieldName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Translate child calls.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue