# Postgres Database

You can access to DB via the following command:

```
[root@ns505185 ~]# psql -U postgres
psql (12.5)
Type "help" for help.

postgres=# \l
                                  List of databases
    Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
------------+----------+----------+-------------+-------------+-----------------------
 class4_dnl | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres   | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
            |          |          |             |             | postgres=CTc/postgres
 template1  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
            |          |          |             |             | postgres=CTc/postgres
(4 rows)

postgres=# \c class4_dnl ;
You are now connected to database "class4_dnl" as user "postgres".
class4_dnl=# 

```

You can get the list of tables with the following commands:

```
class4_dnl=# \d+;
                                                                                          List of relations
 Schema |                       Name                       |   Type   |    Owner    |    Size    |                                            Description                                            
--------+--------------------------------------------------+----------+-------------+------------+---------------------------------------------------------------------------------------------------
 public | agent                                            | table    | postgres    | 0 bytes    | 
 public | agent_agent_id_seq                               | sequence | postgres    | 8192 bytes | 
 public | agent_client_client                              | table    | postgres    | 0 bytes    | 
 public | agent_client_client_id_seq                       | sequence | postgres    | 8192 bytes | 
 public | agent_client_client_record                       | table    | postgres    | 8192 bytes | 
 public | agent_client_client_record_record_id_seq         | sequence | postgres    | 8192 bytes | 
 public | agent_clients                                    | table    | postgres    | 0 bytes    | 
 public | agent_clients_id_seq                             | sequence | postgres    | 8192 bytes | 
 public | agent_commission_history                         | table    | postgres    | 8192 bytes | 
 public | agent_commission_history_detail                  | table    | postgres    | 8192 bytes | 
 public | agent_commission_history_detail_id_seq           | sequence | postgres    | 8192 bytes | 
 public | agent_commission_history_history_id_seq          | sequence | postgres    | 8192 bytes | 
 public | agent_commission_payment                         | table    | postgres    | 8192 bytes | 
 public | agent_commission_payment_id_seq                  | sequence | postgres    | 8192 bytes | 
 public | alembic_version                                  | table    | postgres    | 8192 bytes | 
 public | alert_rules                                      | table    | postgres    | 8192 bytes | 
 public | alert_rules_id_seq                               | sequence | postgres    | 8192 bytes | 
 public | alert_rules_log                                  | table    | postgres    | 8192 bytes | 
 public | alert_rules_log_detail                           | table    | postgres    | 8192 bytes | 
 public | alert_rules_log_detail_id_seq                    | sequence | postgres    | 8192 bytes | 
 public | alert_rules_log_id_seq                           | sequence | postgres    | 8192 bytes | 
 public | allowed_sendto_ip                                | table    | postgres    | 0 bytes    | 
 public | allowed_sendto_ip_id_seq                         | sequence | postgres    | 8192 bytes | 
 public | allowed_sendto_ip_record                         | table    | postgres    | 8192 bytes | 
 public | allowed_sendto_ip_record_record_id_seq           | sequence | postgres    | 8192 bytes | 
 public | async_ftp_export                                 | table    | postgres    | 8192 bytes | 

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cookbook.denovolab.com/data-access/postgres-database.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
