I would like to autoformat / beautify my SQL-queries directly in pgAdmin4. I know this feature from Java-developing in Eclipse, where I can beautify the whole code using a simple shortcut.
I only found a command line solution so far that makes my SQL queries pretty: pgFormatter.
Added option to trigger autocomplete on key press in the query tool. This feature allows autocomplete to be accessed with a key press in the query tool. One new parameter is added to Preferences -> Query Tool -> Auto completion -> 'Autocomplete on key press' to disable it.
The Query Tool is a powerful, feature-rich environment that allows you to execute arbitrary SQL commands and review the result set. You can access the Query Tool via the Query Tool menu option on the browser tree tools menu or through the context menu of selected nodes of the browser tree control.
I recently discovered in PGAdmin III that you can autocomplete/activate intellisense by hitting Ctrl+Space.
The SQL Editor Panel¶ For example, type “SELECT * FROM” (without quotes, but with a trailing space), and then press the Control+Space key combination to select from a popup menu of autocomplete options. After entering a query, select the Execute/Refresh icon from the toolbar.
Try the following command:
shift+Ctrl+k
Currently this feature is not implemented in pgadmin4 which does autoformat or beautify SQL-queries automatically but you can expect this feature in near future version as developers are working on this feature.
Developers discussion mail thread for the feature: https://www.postgresql.org/message-id/CAPG3WN46pgzxKERPpr4TSpVFtyeMhParjvKAUzXWOuwZ4qJPhg@mail.gmail.com
In pgAdmin5 on macOS this can be done using Shift + Cmd + K
.
Here is where you can find it in the UI:
Still not implemented afaict, but an option would be to use some online tool.
I've successfully used: https://sqlformat.org/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With