mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 21:33:28 +01:00
Fix for issue #14 - Use db_name in query
As pointed out by @wglambert the db_name needs to be specified when POSTGRES_DB was set: https://github.com/docker-library/postgres/issues/854#issuecomment-856877311
This commit is contained in:
@@ -203,7 +203,9 @@ backup_mysql() {
|
||||
backup_pgsql() {
|
||||
if var_true $SPLIT_DB ; then
|
||||
export PGPASSWORD=${dbpass}
|
||||
DATABASES=$(psql -h $dbhost -U $dbuser -p ${dbport} -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' )
|
||||
authdb=${DB_USER}
|
||||
[ -n "${DB_NAME}" ] && authdb=${DB_NAME}
|
||||
DATABASES=$(psql -h $dbhost -U $dbuser -p ${dbport} -d ${authdb} -c 'COPY (SELECT datname FROM pg_database WHERE datistemplate = false) TO STDOUT;' )
|
||||
for db in $DATABASES; do
|
||||
print_info "Dumping database: $db"
|
||||
target=pgsql_${db}_${dbhost}_${now}.sql
|
||||
|
||||
Reference in New Issue
Block a user