I use psql’s output-formatting options as part of what makes it a highly usable Postgres editor. These notes collect my preferences and ongoing experiments with query display; they complement my broader customizing psql settings and getting started with psql notes.
If I could have 1 and only 1 thing in my .psqlrc file, it would be \x auto.
I love using \x auto to format results in psql, and I describe it as automatically formatting query results to display most cleanly based on the terminal and font size.
When people ask what Postgres editor I use and I say psql, I know they may think I’m kidding; formatting options like these are part of what makes it incredibly usable.
The formatting example I shared was from @crunchydata: its \pset border 2 setting produces double-line borders around the top, bottom, and header, with single lines between rows. I presented the example as evidence of psql’s usability.
I’m increasingly torn between having \x auto and using \a for aligned output off, so I can do more fun things with colors in my query results; I have not settled on a choice.
Related: using psql as an editor, customizing psql settings, psql exports and shell commands