def METHOD_NAME(self) -> StatusResponse:
    """
    Check the connection of the PostgreSQL database
    :return: success status and error message if error occurs
    """
    response = StatusResponse(False)
    need_to_close = self.is_connected is False
    try:
        connection = self.connect()
        with connection.cursor() as cur:
            cur.execute('select 1;')
        response.success = True
    except psycopg.Error as e:
        log.logger.error(f'Error connecting to PostgreSQL {self.database}, {e}!')
        response.error_message = e
    if response.success is True and need_to_close:
        self.disconnect()
    if response.success is False and self.is_connected is True:
        self.is_connected = False
    return response