Maybe for avoid some code duplication do it like this?
```
function checkPostgreSQLContainer() {
  if [[ ! -f "$DOKKU_ROOT/.postgresql/pwd_$APP" ]]; then
    echo "Unknown (or too old) PostgreSQL container"
    exit 1
  fi
}
```

```
function checkPostgreSQLTool() {
  local toolName="$1"
  if [[ $(whereis $toolName | awk '{ print NF }') -eq 1 ]]; then
    echo "'$toolName' not found. Is the package 'postgresql-client' installed?"
    exit 1
  fi
}
```