R: Check if default database is available.

postgresHasDefault {RPostgres} | R Documentation

## Check if default database is available.

### Description

RPostgres examples and tests connect to a default database via `dbConnect(``RPostgres::Postgres()``)`. This function checks if that database is available, and if not, displays an informative message.

`postgresDefault()` works similarly but returns a connection on success and throws a testthat skip condition on failure, making it suitable for use in tests.

### Usage

    postgresHasDefault(...)

    postgresDefault(...)

### Arguments

`...` | Additional arguments passed on to `dbConnect()`

### Examples

    if (postgresHasDefault()) {
      db <- postgresDefault()
      dbListTables(db)
      dbDisconnect(db)
    }

[Package RPostgres version 1.1.1 Index]