Skip to content

Logic Uses Username as a DB name #196

Closed
@matt-laird

Description

@matt-laird

Summary

When a backup of my Postgres DB occurs, I get an error on Postgres side saying that a specific target DB doesn't exist. However, the DB that is being incorrectly targeted is the given username.

Steps to reproduce

  1. Setup a backup using the below provided env var.
  2. Allow backup to occur and observe the error message on the Container & Postgres instance respectively. Provided below.

What is the expected correct behavior?

Do not use the given username as a target DB.

Relevant logs and/or screenshots

Container

...
2022-12-21.23:20:57 [NOTICE] ** [timezone] Timezone: Setting to 'Africa/Johannesburg' from 'Etc/GMT'
2022-12-22.01:20:57 [NOTICE] ** [scheduling] Container configured for scheduled tasks with 'cron'
2022-12-22.01:20:59 [STARTING] ** [scheduling] [1] Starting cron
2022-12-22.01:21:03 [INFO] ** [db-backup] Next Backup at 2022-12-22 01:21:03 SAST
2022-12-22.01:21:04 [NOTICE] ** [db-backup] Dumping all PostgreSQL databases: 'nextcloud' and compressing with 'zstd'
psql: error: connection to server at "db" (172.16.28.3), port 5432 failed: FATAL:  database "nextcloud_owner" does not exist
...

Postgres

...
2022-12-21 23:21:04.062 UTC [25527] FATAL:  database "nextcloud_owner" does not exist
...

Environment

Env vars:

  TIMEZONE=Africa/Johannesburg
  CONTAINER_ENABLE_MONITORING=FALSE
  SPLIT_DB=FALSE
  DB_TYPE=pgsql
  DB_HOST=db
  DB_PORT=5432
  DB_NAME=nextcloud
  DB_USER=nextcloud_owner
  DB_PASS=[REDACTED]
  DB_DUMP_FREQ=180
  DB_CLEANUP_TIME=1440
  CHECKSUM=SHA1
  COMPRESSION=ZSTD
  COMPRESSION_LEVEL=6
  • Image version / tag: <= 3.7.3
  • Host OS: Debian

Possible fixes

I think the problem lies somewhere here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions