Fix minor parser bug

This commit is contained in:
Vikram Rangnekar 2020-03-17 23:03:41 -04:00
parent f69f1c67d5
commit 1ad8cbf15b
1 changed files with 5 additions and 1 deletions

View File

@ -93,7 +93,7 @@ func (co *Compiler) compileQuery(qc *qcode.QCode, w io.Writer, vars Variables) (
io.WriteString(c.w, `SELECT json_build_object(`) io.WriteString(c.w, `SELECT json_build_object(`)
for _, id := range qc.Roots { for _, id := range qc.Roots {
root := &qc.Selects[id] root := &qc.Selects[id]
if root.SkipRender { if root.SkipRender || len(root.Cols) == 0 {
continue continue
} }
@ -126,6 +126,10 @@ func (co *Compiler) compileQuery(qc *qcode.QCode, w io.Writer, vars Variables) (
if id < closeBlock { if id < closeBlock {
sel := &c.s[id] sel := &c.s[id]
if len(sel.Cols) == 0 {
continue
}
ti, err := c.schema.GetTable(sel.Name) ti, err := c.schema.GetTable(sel.Name)
if err != nil { if err != nil {
return 0, err return 0, err