How to:
Login to PostgreSQL.
Display a table in a clean format.
* Prerequisite: Shell access with admin privileges
Step: 1 > Switch to postgres user
:~$ sudo su postgres
Step: 2 > Start the PostgreSQL database
admin$ psql
Step: 3 > Connect to the required database
postgres=# \c <database name>
For instance;
\c vnms # will connect to vnms database
Step: 4 > Retrieve data from a table
vnms=# SELECT * FROM <table> WHERE name='<NAME>';
For instance;
SELECT * FROM appliance WHERE name='Branch-1'; # will retrieve all data for Branch-1 from appliance table
Here the output that is retrieved is not in a human readable format
To get the same output in a better format, enable expanded display.
vnms=# \x
vnms=# SELECT * FROM appliance WHERE name='Branch-1';
###############################################################################
* This KB is for demonstration purpose only. Please avoid logging into database without consulting Versa TAC