Skip to content

Commit f6d8d00

Browse files
authored
Fix server version request in basebackup.sh (#1184)
1 parent 32fe3ca commit f6d8d00

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

postgres-appliance/scripts/basebackup.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ done
1919

2020
[[ -z $DATA_DIR || -z "$CONNSTR" || ! $RETRIES =~ ^[1-9]$ ]] && exit 1
2121

22+
if [[ ! $CONNSTR =~ dbname= ]]; then
23+
CONNSTR="${CONNSTR} dbname=postgres"
24+
fi
25+
2226
if which pg_receivewal &> /dev/null; then
2327
PG_RECEIVEWAL=pg_receivewal
2428
PG_BASEBACKUP_OPTS=(-X none)
@@ -95,7 +99,7 @@ else
9599
receivewal_pid=$(cat "$WAL_FAST/receivewal.pid")
96100
fi
97101

98-
PGVER=$(psql -d "$CONNSTR" -tAc "SELECT pg_catalog.current_setting('server_version_num')::int/10000" || echo 0)
102+
PGVER=$(psql "$CONNSTR" -tAc "SELECT pg_catalog.current_setting('server_version_num')::int/10000" || echo 0)
99103
if [[ $PGVER -ge 15 ]]; then
100104
PG_BASEBACKUP_OPTS+=("--compress=server-lz4")
101105
fi

0 commit comments

Comments
 (0)