Fix role filters and nested where bugs

This commit is contained in:
Vikram Rangnekar
2020-01-13 09:34:15 -05:00
parent 1e31e33707
commit 7c02226016
5 changed files with 45 additions and 25 deletions

View File

@ -80,7 +80,7 @@ func (trv *trval) allowedColumns(qt QType) map[string]struct{} {
case QTUpdate:
return trv.update.cols
case QTDelete:
return trv.insert.cols
return trv.delete.cols
case QTUpsert:
return trv.insert.cols
}

View File

@ -940,10 +940,13 @@ func setWhereColName(ex *Exp, node *Node) {
list = append([]string{k}, list...)
}
}
if len(list) == 1 {
listlen := len(list)
if listlen == 1 {
ex.Col = list[0]
} else if len(list) > 1 {
ex.NestedCols = list
} else if listlen > 1 {
ex.Col = list[listlen-1]
ex.NestedCols = list[:listlen]
}
}
@ -996,6 +999,11 @@ func compileFilter(filter []string) (*Exp, error) {
return nil, err
}
// TODO: Invalid table names in nested where causes fail silently
// returning a nil 'f' this needs to be fixed
// TODO: Invalid where clauses such as missing op (eg. eq) also fail silently
if fl == nil {
fl = f
} else {