diff --git a/db/modify.go b/db/modify.go index 479c54d6..5ccf0792 100644 --- a/db/modify.go +++ b/db/modify.go @@ -51,6 +51,20 @@ func executeModifyStatement(txn kvs.TX, ast *sql.ModifyStatement) (out []interfa } } + if what, ok := w.(*sql.Table); ok { + beg := &keys.Thing{KV: ast.KV, NS: ast.NS, DB: ast.DB, TB: what.TB, ID: keys.Prefix} + end := &keys.Thing{KV: ast.KV, NS: ast.NS, DB: ast.DB, TB: what.TB, ID: keys.Suffix} + kvs, _ := txn.RGet(beg.Encode(), end.Encode(), 0) + for _, kv := range kvs { + doc := item.New(kv, txn, nil) + if ret, err := modify(doc, ast); err != nil { + return nil, err + } else if ret != nil { + out = append(out, ret) + } + } + } + } if local { diff --git a/sql/modify.go b/sql/modify.go index 406e4a80..2e268743 100644 --- a/sql/modify.go +++ b/sql/modify.go @@ -24,7 +24,7 @@ func (p *Parser) parseModifyStatement(explain bool) (stmt *ModifyStatement, err stmt.NS = p.c.Get("NS").(string) stmt.DB = p.c.Get("DB").(string) - if stmt.What, err = p.parseThings(); err != nil { + if stmt.What, err = p.parseWhat(); err != nil { return nil, err }