[type/__postgres_conf] Add psql_conf_source function to state explorer
This commit is contained in:
parent
2ccc03fef1
commit
e0416403c4
1 changed files with 5 additions and 2 deletions
|
@ -27,6 +27,10 @@ psql_exec() {
|
||||||
su - "${postgres_user}" -c "psql postgres -twAc $(quote "$*")"
|
su - "${postgres_user}" -c "psql postgres -twAc $(quote "$*")"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
psql_conf_source() {
|
||||||
|
# NOTE: SHOW/SET are case-insentitive, so this command should also be.
|
||||||
|
psql_exec "SELECT CASE WHEN source = 'default' OR setting = boot_val THEN 'default' ELSE source END FROM pg_settings WHERE lower(name) = lower('$1')"
|
||||||
|
}
|
||||||
psql_conf_cmp() {
|
psql_conf_cmp() {
|
||||||
test "$(psql_exec "SHOW $1")" = "$2"
|
test "$(psql_exec "SHOW $1")" = "$2"
|
||||||
}
|
}
|
||||||
|
@ -40,8 +44,7 @@ if psql_conf_cmp "${conf_name}" "$(cat "${__object:?}/parameter/value")"
|
||||||
then
|
then
|
||||||
echo present
|
echo present
|
||||||
else
|
else
|
||||||
# NOTE: SHOW/SET are case-insentitive, so this command should also be.
|
case $(psql_conf_source "${conf_name}")
|
||||||
case $(psql_exec "SELECT CASE WHEN source = 'default' OR setting = boot_val THEN 'default' ELSE source END FROM pg_settings WHERE lower(name) = lower('${conf_name}')")
|
|
||||||
in
|
in
|
||||||
('')
|
('')
|
||||||
# invalid configuration parameter
|
# invalid configuration parameter
|
||||||
|
|
Loading…
Reference in a new issue