PostgreSQL: Display results vertically

Sometimes you just need to quickly skim sample data from the database, but reading long data horizontally is a bit of a mess.

To read results vertically, toggle the expanded display mode using "\x".

content=# \x

Expanded display is on.
content=# select * from table_name;
-[ RECORD 1 ]-----------+-----------------------------
id                      | 8
when                    | 2010-03-02 13:37:33.64327+11
salutation              | Mr
first_name              | twig
address_street_number   | 123
address_street_name     | French Girl
address_suburb          | Has A Reason
address_state           | For Hurting Boyfriend
address_postcode        | 1234
address_country         | France
no_promotional_material | t

content=# \x
Expanded display is off.

In case you're wondering, the french girl reference is from a song called "The Presidents of USA - French Girl".

Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog