Summary
validate_query currently reports valid: true for a PL/pgSQL block that should fail at runtime because format() has more %s placeholders than arguments inside a RAISE EXCEPTION expression.
I hit this while evaluating dryrun v0.8.0 as a migration-safety guardrail. This is reproducible through the MCP validate_query tool once a schema is loaded.
Minimal repro
Run dryrun MCP with any loaded schema, then call validate_query with:
DO $$
BEGIN
RAISE EXCEPTION 'bad format output: %', format('value %s %s', 'one');
END
$$;
Observed response:
{
"valid": true,
"errors": null,
"warnings": null,
"_meta": {
"hint": "Query is valid. Use advise if you need optimization suggestions.",
"mode": "offline",
"pg_version": "18.3.0"
}
}
Expected behavior
I would expect validate_query to flag this as invalid, or at least warn that PL/pgSQL expression bodies / format() placeholder arity are not validated.
PostgreSQL will reject the inner format('value %s %s', 'one') call at execution time because the format string expects two arguments but receives one. In migrations, this class of issue can hide inside DO $$ ... $$ or function bodies and only surface when the migration executes.
Environment
- dryrun version:
v0.8.0
- PostgreSQL version in loaded schema metadata:
18.3.0
- Tool path: MCP
validate_query
Thanks for building this. The schema linting and migration-lock checks were useful; this issue is specifically about the PL/pgSQL/body-validation boundary.
Summary
validate_querycurrently reportsvalid: truefor a PL/pgSQL block that should fail at runtime becauseformat()has more%splaceholders than arguments inside aRAISE EXCEPTIONexpression.I hit this while evaluating dryrun v0.8.0 as a migration-safety guardrail. This is reproducible through the MCP
validate_querytool once a schema is loaded.Minimal repro
Run dryrun MCP with any loaded schema, then call
validate_querywith:Observed response:
{ "valid": true, "errors": null, "warnings": null, "_meta": { "hint": "Query is valid. Use advise if you need optimization suggestions.", "mode": "offline", "pg_version": "18.3.0" } }Expected behavior
I would expect
validate_queryto flag this as invalid, or at least warn that PL/pgSQL expression bodies /format()placeholder arity are not validated.PostgreSQL will reject the inner
format('value %s %s', 'one')call at execution time because the format string expects two arguments but receives one. In migrations, this class of issue can hide insideDO $$ ... $$or function bodies and only surface when the migration executes.Environment
v0.8.018.3.0validate_queryThanks for building this. The schema linting and migration-lock checks were useful; this issue is specifically about the PL/pgSQL/body-validation boundary.