postgresql_schema: use query_params with cursor object (#65679)

pull/64156/head^2
Andrew Klychkov 5 years ago committed by Abhijit Menon-Sen
parent 2e82989b3b
commit c791f916d3

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

@ -165,15 +165,15 @@ def set_owner(cursor, schema, owner):
def get_schema_info(cursor, schema):
query = ("SELECT schema_owner AS owner "
"FROM information_schema.schemata "
"WHERE schema_name = '%s'" % schema)
cursor.execute(query)
"WHERE schema_name = %(schema)s")
cursor.execute(query, {'schema': schema})
return cursor.fetchone()
def schema_exists(cursor, schema):
query = ("SELECT schema_name FROM information_schema.schemata "
"WHERE schema_name = '%s'" % schema)
cursor.execute(query)
"WHERE schema_name = %(schema)s")
cursor.execute(query, {'schema': schema})
return cursor.rowcount == 1

Loading…
Cancel
Save