dry_run_sql_file
Test SQL migrations safely by executing all statements in a transaction, capturing real results and errors, then rolling back to prevent changes.
Instructions
Execute a SQL file in dry-run mode - actually runs ALL statements within a transaction, captures REAL results for each (row counts, errors with line numbers, constraint violations), then ROLLBACK so nothing persists. Perfect for testing migrations before deploying. Returns detailed error info including PostgreSQL error codes, constraint names, and hints to help quickly fix issues. Warns about non-rollbackable operations (sequences, VACUUM, etc.). Optionally use server/database/schema params for one-time execution on a different server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute or relative path to the .sql file to dry-run | |
| stripPatterns | No | Patterns to strip from SQL before execution (e.g., ['/'] for Liquibase) | |
| stripAsRegex | No | If true, stripPatterns are treated as regex patterns | |
| maxStatements | No | Maximum statements to include in results (default: 50, max: 200) | |
| stopOnError | No | Stop on first error (default: false - continues to show ALL errors) | |
| server | No | One-time server override. Execute on this server without changing main connection. | |
| database | No | One-time database override. Uses this database for execution. | |
| schema | No | One-time schema override. Sets search_path for this execution only. |