validateQuery
validateQueryCheck if a SELECT, WITH, or EXPLAIN statement is valid without executing it: prepares the statement to verify syntax, parameters, and referenced objects. Use to catch errors before running a query.
Instructions
Check whether the database driver accepts a SELECT / WITH / EXPLAIN without executing it: prepares the statement and validates parameters, syntax and referenced objects. Use inspectQuery for parser-only AST inspection or queryLint for advisory metadata/index warnings. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| params | No | Positional parameters for '?' placeholders, in order. Required when SQL contains '?'. | |
| connection | Yes | Database to run against. Call listConnections for valid names; do not guess. | |
| namedParams | No | Named parameters for ':name' placeholders. Required when SQL contains ':name'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | No | ||
| stage | No | Validation stage that failed, such as guard, params, or driver. | |
| valid | Yes | True when the statement passed guard, parameter, and driver validation. | |
| columns | No | Number of result columns reported by driver validation when available. | |
| inspection | No | Parsed query inspection that underpins validation (opaque; the inspectQuery tool returns the typed form). | |
| parameters | No | Number of SQL parameters expected or validated. |