List the database, schema, tables, users, views & roles in PostgreSQL

Check the database, schema , views, tables, users & roles in PostgreSQL

Check the database present in the PostgreSQL:

\l

Check the list of tables present in the PostgreSQL:

\dt

Example:
testdb=# \dt
        List of relations
 Schema | Name | Type  |  Owner
--------+------+-------+----------
 public | test | table | postgres
(1 row)

Check the views present in the PostgreSQL:

\dv

Check the list of function present in the PostgrSQL:

\df

Check the list of schemas present in the PostgrSQL:

\dn

Example:
testdb=# \dn
      List of schemas
  Name  |       Owner
--------+-------------------
 public | pg_database_owner
(1 row)

Check the list of user present in the PostgreSQL:

\du

Example:
postgres=# \du
                                   List of roles
 Role name |                         Attributes                         | Member of
-----------+------------------------------------------------------------+-----------
 postgres  | Superuser, Create role, Create DB, Replication, Bypass RLS | {}

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.