As shown in the title of this article, this is an article written solely to describe how to show all view in PostgreSQL. If there are views created in PostgreSQL Database Server, it can be enlisted or it can be shown in the following based on the pattern :
But for specific reasons, the command pattern above must be executed in PostgreSQL Command Console. In order to be able to execute the command, it can be done after doing the following steps :
1. Define the PostgreSQL Database Server which is going to be accessed in order to list all the views. Including to make sure it is already exist and it is listening for an incoming request.
2. Try to connect to PostgreSQL Database Server which is specified in the first step. The connection can be done using psql command with the right and proper argument passed through along with psql command. The right and proper argument includes the username, host and password along with the database name which is going to be accessed where the views are available.
3. The following is the example of the above command executed for listing all of the available views in the already connected database :
postgres=# \c dbname psql (9.5.9, server 9.3.10) You are now connected to database "dbname" as user "postgres". dbname=#
4. As soon as the connection successfully made, just execute the command ‘\dv’ in PostgreSQL Command Console :
dbname=# \dv List of relations Schema | Name | Type | Owner --------+-------------------------+------+---------- public | v_user | view | postgres public | v_account | view | postgres public | v_ticket | view | postgres public | v_blog | view | postgres public | v_temp | view | postgres public | v_budget | view | postgres public | v_test | view | postgres (7 rows) dbname=#
As shown in the above output command executed, all the available views exist in the database is enlisted. The database which is specified in the context of the above output command generated is ‘dbname’. There are seven views in total exist in the database.