When Gemini outputs SQL, it automatically inserts blank lines in specific positions (as shown in the screenshot), particularly between SQL blocks such as before UNION ALL, after closing parentheses, or between subqueries and outer queries.
These blank lines are not related to comments. The issue is caused by incorrect blank line handling in specific structural locations of the SQL statement. After copying the generated SQL, I must manually delete these blank lines before execution.
Even if I explicitly instruct Gemini to remove blank lines and ensure the SQL is directly executable without modification, it only follows the instruction temporarily. After some time, it forgets the formatting requirement and starts inserting blank lines again, forcing me to repeatedly restate the same instruction.
This creates unnecessary manual work and repeated prompt overhead. The core issue is:
-
Gemini inserts extra blank lines in structurally sensitive SQL positions.
-
The model does not persist user-defined formatting rules (e.g., “no blank lines, directly executable SQL”).
This behavior significantly impacts efficiency when generating production-ready SQL.
Expected behavior:
-
No unnecessary blank lines in structurally sensitive SQL positions.
-
User-specified formatting constraints (such as “no blank lines”) should be consistently respected across the session.
