You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Thank you @eberns1995 - this is genuine gap and you've pinpointed it perfectly. validate_query now does full query parse. But the limitation is that it stops as procedural-body and marks it as valid. PL/pgSQL is never parsed as it is now.
As immediate 'workaround' I will prepare a fix to emit warning about this.
The proper fix (or better to call this feature) is going to be bit more complicated:
Activity
radim commentedon May 29, 2026
Thank you @eberns1995 - this is genuine gap and you've pinpointed it perfectly.
validate_querynow does full query parse. But the limitation is that it stops as procedural-body and marks it as valid. PL/pgSQL is never parsed as it is now.As immediate 'workaround' I will prepare a fix to emit warning about this.
The proper fix (or better to call this feature) is going to be bit more complicated:
All this is on my roadmap, but at the moment can't promise ETA (definitely not for v0.9)
chore: warning that PL/pgSQL and anonymous blocks are not (yet) stati…
test: cover PL/pgSQL body not-validated warnings