From 01e488b69d232a09edff8816f27ef3b0c1e9849c Mon Sep 17 00:00:00 2001 From: Vikram Rangnekar Date: Sat, 21 Mar 2020 20:11:04 -0400 Subject: [PATCH] Fix for bug blocking anon queries --- psql/update.go | 4 ++++ serv/core_build.go | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/psql/update.go b/psql/update.go index 9734944..89da36f 100644 --- a/psql/update.go +++ b/psql/update.go @@ -222,6 +222,10 @@ func (c *compilerContext) renderDelete(qc *qcode.QCode, w io.Writer, quoted(c.w, ti.Name) io.WriteString(c.w, ` WHERE `) + if root.Where == nil { + return 0, errors.New("'where' clause missing in delete mutation") + } + if err := c.renderWhere(root, ti); err != nil { return 0, err } diff --git a/serv/core_build.go b/serv/core_build.go index 1efd622..ef5f5ba 100644 --- a/serv/core_build.go +++ b/serv/core_build.go @@ -59,12 +59,6 @@ func buildRoleStmt(gql, vars []byte, role string) ([]stmt, error) { return nil, err } - // For the 'anon' role in production only compile - // queries for tables defined in the config file. - if conf.Production && ro.Name == "anon" && !hasTablesWithConfig(qc, ro) { - return nil, errors.New("query contains tables with no 'anon' role config") - } - stmts := []stmt{stmt{role: ro, qc: qc}} w := &bytes.Buffer{}