Taming PgAdmin's SQL Formatting
William Lake
Posted on March 31, 2022
The example query I'm using came from here.
Qualifiers
I really appreciate PgAdmin and everyone who's built it.
Who knows what I'd be doing without their hard work.
More Qualifiers
I haven't read every line of their documentation. Maybe their setup instructions include this on the very first page. Maybe they've surrounded it with exclamation points and made it bold & red. The point is, if they did- I missed it. If you find this helpful- great! If not, that's ok too. Take what works and leave the rest. Or don't, I'm not the cops.
Getting to the Point
- Click inside your Query Editor and use this keyboard shortcut to format your SQL:
Ctrl + Shift + k
- You'll need to do this after any change to these preferences in order to see the effects.
- From the top-most "File" menu:
- File -> Preferences
- Query Tool -> SQL formatting
- Set these options for very compact SQL.
- Set these options for less compact, but easier to read SQL.
Very Compact SQL
Option | Value |
---|---|
Re-indent aligned? | True |
Re-indent? | False |
Spaces around operators? | False |
Tab size | 2 |
Use spaces? | True |
Less Compact Easier to Read
Option | Value |
---|---|
Re-indent aligned? | True |
Re-indent? | True |
Spaces around operators? | False |
Tab size | 2 |
Use spaces? | True |
💖 💪 🙅 🚩
William Lake
Posted on March 31, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.