This post shows how to show query output in the pretty-format using psql command:
Show query output in the pretty-format
Enter below psql command to show query output in the pretty-format:
\x
Example: Execute the below command to expand query result:
mydb=# \x
Expanded display is on.
mydb=# select * from users;
-[ RECORD 1 ]--------------
id | 1
name | Tony
email | tony@gmail.com
country | US
password | secret
-[ RECORD 2 ]--------------
id | 2
name | Ramesh
email | ramesh@gmail.com
country | India
password | password123
-[ RECORD 3 ]--------------
id | 3
name | John
email | john@gmail.com
country | US
password | password123
Execute "\x" command to disable expand like:
mydb=# \x
Expanded display is off.
mydb=# select * from users;
id | name | email | country | password
----+--------+------------------+---------+-------------
1 | Tony | tony@gmail.com | US | secret
2 | Ramesh | ramesh@gmail.com | India | password123
3 | John | john@gmail.com | US | password123
(3 rows)
Comments
Post a Comment