Validate SQL without running it
pg_validate_sqlValidate read-only SQL without executing it: check syntax, object names, safety rules, result columns/types, touched tables, and cost estimate. Test queries or diagnose why pg_query refuses them.
Instructions
Check a read query without executing it: syntax, object names, safety rules, result columns with types, tables it would touch and its estimated cost.
Use it to test SQL you are about to give to the user, or to see exactly why pg_query would refuse a statement.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sql": "<sql>"
},
"name": "pg_validate_sql"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | ||
| params | No | ||
| connection | No |