postgresql_sequence: use query parameters with cursor object (#65787)

This commit is contained in:
Andrew Klychkov 2019-12-14 07:16:27 +03:00 committed by Abhijeet Kasurde
parent c5a42a9ac6
commit 24b1409667
3 changed files with 8 additions and 5 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- postgresql_sequence - use query parameters with cursor object (https://github.com/ansible/ansible/pull/65787).

View file

@ -369,11 +369,12 @@ class Sequence(object):
"LEFT JOIN pg_namespace n ON n.oid = c.relnamespace "
"WHERE NOT pg_is_other_temp_schema(n.oid) "
"AND c.relkind = 'S'::\"char\" "
"AND sequence_name = '%s' "
"AND sequence_schema = '%s'" % (self.name,
self.schema))
"AND sequence_name = %(name)s "
"AND sequence_schema = %(schema)s")
res = exec_sql(self, query, add_to_executed=False)
res = exec_sql(self, query,
query_params={'name': self.name, 'schema': self.schema},
add_to_executed=False)
if not res:
self.exists = False

View file

@ -1,3 +1,3 @@
# Initial CI tests of postgresql_sequence module
- import_tasks: postgresql_sequence_initial.yml
when: postgres_version_resp.stdout is version('9.0', '>=')
when: postgres_version_resp.stdout is version('9.4', '>=')