[type/__postgres_conf] Compare configuration parameter names case insensitively

This commit is contained in:
Dennis Camera 2021-01-18 19:39:56 +01:00
parent 803367b316
commit 891c98567e
2 changed files with 4 additions and 2 deletions

View File

@ -39,4 +39,5 @@ esac
conf_name=${__object_id:?}
su - "${postgres_user}" -c "psql postgres -twAc \"SELECT context FROM pg_settings WHERE name = '${conf_name}'\""
# NOTE: SHOW/SET are case-insentitive, so this command should also be.
su - "${postgres_user}" -c "psql postgres -twAc \"SELECT context FROM pg_settings WHERE lower(name) = lower('${conf_name}')\""

View File

@ -42,7 +42,8 @@ if su - "${postgres_user}" -c "psql postgres -twAc 'SHOW ${conf_name}'" \
then
echo present
else
case $(su - "${postgres_user}" -c "psql postgres -tAwc \"SELECT CASE WHEN source = 'default' OR setting = boot_val THEN 'default' ELSE source END FROM pg_settings WHERE name = '${conf_name}'\"")
# NOTE: SHOW/SET are case-insentitive, so this command should also be.
case $(su - "${postgres_user}" -c "psql postgres -tAwc \"SELECT CASE WHEN source = 'default' OR setting = boot_val THEN 'default' ELSE source END FROM pg_settings WHERE lower(name) = lower('${conf_name}')\"")
in
('')
# invalid configuration parameter