analyzeSafe runs AnalyzeSelectStmt but returns (nil, err) instead of failing the test — probe tests need to record whether analyze succeeded.
(cat *catalog.Catalog, sql string)
| 2508 | // analyzeSafe runs AnalyzeSelectStmt but returns (nil, err) instead of failing |
| 2509 | // the test — probe tests need to record whether analyze succeeded. |
| 2510 | func analyzeSafe(cat *catalog.Catalog, sql string) (*catalog.Query, error) { |
| 2511 | stmts, err := ParsePg(sql) |
| 2512 | if err != nil { |
| 2513 | return nil, errors.Wrap(err, "parse") |
| 2514 | } |
| 2515 | sel, ok := stmts[0].AST.(*ast.SelectStmt) |
| 2516 | if !ok { |
| 2517 | return nil, errors.Errorf("not a SelectStmt: %T", stmts[0].AST) |
| 2518 | } |
| 2519 | return cat.AnalyzeSelectStmt(sel) |
| 2520 | } |
| 2521 | |
| 2522 | func targetsOf(q *catalog.Query) int { |
| 2523 | if q == nil { |
no test coverage detected