From 891c98567e1d94577dc4f20d3ec9f73f4927fd24 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Mon, 18 Jan 2021 19:39:56 +0100 Subject: [PATCH] [type/__postgres_conf] Compare configuration parameter names case insensitively --- cdist/conf/type/__postgres_conf/explorer/context | 3 ++- cdist/conf/type/__postgres_conf/explorer/state | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cdist/conf/type/__postgres_conf/explorer/context b/cdist/conf/type/__postgres_conf/explorer/context index 3a2fa504..def5f676 100644 --- a/cdist/conf/type/__postgres_conf/explorer/context +++ b/cdist/conf/type/__postgres_conf/explorer/context @@ -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}')\"" diff --git a/cdist/conf/type/__postgres_conf/explorer/state b/cdist/conf/type/__postgres_conf/explorer/state index 400b27e8..a4930296 100644 --- a/cdist/conf/type/__postgres_conf/explorer/state +++ b/cdist/conf/type/__postgres_conf/explorer/state @@ -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