Display Query Results Vertically With PostgreSQL

Those who are familiar with MySQL may be used to terminating a query with ‘\G’ to have the client output the query results vertically with each column/value pair a line at a time. There is in a equivalent in PostgreSQL too. The psql client uses ‘\x’ to toggle vertical output, and ‘\g’ to send the current buffer to the server for processing. To get the same effect in psql as ‘\G’ in MySQL, just end your query with ‘\x\g\x’.

  • http://code-zen.net/ Peter Anselmo

    Thanks! I use both MySQL and Posgres often, and I’ve been wondering if there was a way to do this.