diff --git a/changelogs/fragments/314-postgresql_info-quote-show-args.yml b/changelogs/fragments/314-postgresql_info-quote-show-args.yml new file mode 100644 index 000000000..9c1e2635d --- /dev/null +++ b/changelogs/fragments/314-postgresql_info-quote-show-args.yml @@ -0,0 +1,2 @@ +bugfixes: +- postgresql_info - make arguments passed to SHOW command properly quoted to prevent the interpreter evaluating them (https://github.com/ansible-collections/community.postgresql/issues/314). diff --git a/plugins/modules/postgresql_info.py b/plugins/modules/postgresql_info.py index ecfd5d51a..f2c4c1154 100644 --- a/plugins/modules/postgresql_info.py +++ b/plugins/modules/postgresql_info.py @@ -1033,7 +1033,7 @@ def get_db_info(self): def __get_pretty_val(self, setting): """Get setting's value represented by SHOW command.""" - return self.__exec_sql("SHOW %s" % setting)[0][0] + return self.__exec_sql('SHOW "%s"' % setting)[0][0] def __exec_sql(self, query): """Execute SQL and return the result."""