dev/formatter
SQL Formatter & Parameter Inserter - Free & Instant | Smocky
Debug SQL is for manual debugging only. Whether a database accepts it depends on its schema, types, and settings. Nothing leaves your browser.
Frequently asked questions
How do I supply parameter values?
Paste one JSON array, such as ["active", 42, true, null]. Strings, numbers, booleans, and null are accepted; nested arrays and objects are rejected with their position. Use [] for SQL without placeholders. Format SQL ignores the parameter field entirely, even if its JSON is malformed.
Can PostgreSQL placeholders repeat or appear out of order?
Yes. $n always means array element n, so "$2 ... $1 ... $2" reuses the second value twice. Every array entry must be referenced at least once, and $0, $01, or an index past the end of the array is rejected. MySQL ? placeholders are consumed left to right, and their count must equal the array length.
Which dialect settings does insertion assume?
PostgreSQL strings are single-quoted, switching to an E'...' escape string when a value contains a backslash or control character. MySQL values assume the default SQL mode, with backslash escapes on and double quotes treated as strings; NO_BACKSLASH_ESCAPES and ANSI_QUOTES are not supported. Placeholders inside strings, quoted identifiers, and comments are never replaced.
Why is a large integer rejected?
Values are read with JSON number semantics in JavaScript, which only represents integers exactly up to ±9,007,199,254,740,991 (the safe integer range). Larger integers would silently lose precision, so pass them as JSON strings instead. Strings are always inserted as quoted SQL strings, never promoted to numbers.
Is the Debug SQL guaranteed to run on my database?
No. It is text for manual debugging. The Tool never connects to a database or executes SQL, and whether the server accepts the statement depends on your schema, column types, and settings. Driver-side type inference and array expansion are not reproduced.
What are the size limits?
SQL and parameter JSON can each contain up to 100,000 UTF-16 code units, with at most 1,000 parameters and 1,000,000 code units of output. Oversized input is reported rather than truncated. Insertion accepts one statement at a time, with an optional trailing semicolon.