postgresql_schema: use query_params with cursor object (#65679)
This commit is contained in:
parent
2e82989b3b
commit
c791f916d3
2 changed files with 6 additions and 4 deletions
|
@ -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…
Reference in a new issue