Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Prevent panics
  • Loading branch information
kyleconroy committed Oct 16, 2023
commit 7bc3d71ddb9052f7138b68a81b9d09a11ebecb85
3 changes: 3 additions & 0 deletions internal/compiler/output_columns.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,9 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro
if err != nil {
return nil, err
}
if qc == nil {
return nil, fmt.Errorf("query catalog is empty")
}
table, cerr := qc.GetTable(fqn)
if cerr != nil {
// TODO: Update error location
Expand Down
5 changes: 4 additions & 1 deletion internal/compiler/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ func (comp *Compiler) resolveCatalogRefs(qc *QueryCatalog, rvs []*ast.RangeVar,
}
table, err := c.GetTable(fqn)
if err != nil {
// If the table name doesn't exist, fisrt check if it's a CTE
if qc == nil {
continue
}
// If the table name doesn't exist, first check if it's a CTE
if _, qcerr := qc.GetTable(fqn); qcerr != nil {
return nil, err
}
Expand Down