postgresql_schema: use query_params with cursor object (#65679)

pull/66383/head
Andrew Klychkov 5 years ago committed by Matt Clay
parent 508ebf295b
commit a45659652d

@ -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