Use cluster_name as default application name on PG 12 and later
This commit is contained in:
parent
ae1960d834
commit
a674949d93
1 changed files with 16 additions and 2 deletions
|
@ -315,8 +315,22 @@ then
|
|||
M_APP_NAME=$( echo "$MASTER_CONN_INFOS"| grep 'application_name=' | sed "s/^.*application_name=[ \'\"]*\([^ \'\"]\+\)[ \'\"]*.*$/\1/" )
|
||||
if [ ! -n "$M_APP_NAME" ]
|
||||
then
|
||||
debug "Master application name not specified, use default: $PG_DEFAULT_APP_NAME"
|
||||
M_APP_NAME=$PG_DEFAULT_APP_NAME
|
||||
if [ $PG_VERSION -ge 12 ]
|
||||
then
|
||||
debug "Master application name not specified, use cluster_name if defined"
|
||||
CLUSTER_NAME=$( psql_get "SELECT current_setting('cluster_name')" )
|
||||
debug "Cluster name: $CLUSTER_NAME"
|
||||
if [ -n "$CLUSTER_NAME" ]
|
||||
then
|
||||
M_APP_NAME=$CLUSTER_NAME
|
||||
else
|
||||
debug "Cluster name not defined, use default: $PG_DEFAULT_APP_NAME"
|
||||
M_APP_NAME=$PG_DEFAULT_APP_NAME
|
||||
fi
|
||||
else
|
||||
debug "Master application name not specified, use default: $PG_DEFAULT_APP_NAME"
|
||||
M_APP_NAME=$PG_DEFAULT_APP_NAME
|
||||
fi
|
||||
else
|
||||
debug "Master application name: $M_APP_NAME"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue