isWriteSelect reports whether a SelectStmt actually writes — and so must not take the read-only editor path. A SELECT writes if it has an INTO target (SELECT ... INTO creates a table) or any of its CTE terms is data-modifying. This is the unified write-detection primitive for the read-only gate; cl
(n *ast.SelectStmt)
| 89 | // classifyQueryType (query_type.go) keeps reporting the root statement type for its |
| 90 | // own consumers — only the detection is shared, not the classifiers' outputs. |
| 91 | func isWriteSelect(n *ast.SelectStmt) bool { |
| 92 | if n == nil { |
| 93 | return false |
| 94 | } |
| 95 | if hasOmniIntoClause(n) { |
| 96 | return true |
| 97 | } |
| 98 | return containsWriteCTE(n) |
| 99 | } |
| 100 | |
| 101 | // containsWriteCTE reports whether any common table expression in the tree is |
| 102 | // data-modifying. Fail-safe by construction — a whitelist, not a denylist: a CTE |
no test coverage detected