From 38d84b1d15daa94b335d3eaeee291fa0eb7459f2 Mon Sep 17 00:00:00 2001 From: Bastien Wirtz Date: Mon, 14 Feb 2022 15:20:38 +0100 Subject: [PATCH] Make sure no substitution attemps is made when params is empty. (#2212) Close #2209 --- patroni/postgresql/__init__.py | 2 +- postgres0.yml | 2 +- postgres1.yml | 2 +- postgres2.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/patroni/postgresql/__init__.py b/patroni/postgresql/__init__.py index 3ca7d651..aeadc3e9 100644 --- a/patroni/postgresql/__init__.py +++ b/patroni/postgresql/__init__.py @@ -264,7 +264,7 @@ class Postgresql(object): cursor = None try: cursor = self._connection.cursor() - cursor.execute(sql, params) + cursor.execute(sql, params or None) return cursor except psycopg.Error as e: if cursor and cursor.connection.closed == 0: diff --git a/postgres0.yml b/postgres0.yml index 4e081de3..4a958ac8 100644 --- a/postgres0.yml +++ b/postgres0.yml @@ -91,7 +91,7 @@ bootstrap: # Some additional users users which needs to be created after initializing new cluster users: admin: - password: admin + password: admin% options: - createrole - createdb diff --git a/postgres1.yml b/postgres1.yml index 15a6897a..17ccfdc2 100644 --- a/postgres1.yml +++ b/postgres1.yml @@ -85,7 +85,7 @@ bootstrap: # Some additional users users which needs to be created after initializing new cluster users: admin: - password: admin + password: admin% options: - createrole - createdb diff --git a/postgres2.yml b/postgres2.yml index 829209ff..c17dd7d0 100644 --- a/postgres2.yml +++ b/postgres2.yml @@ -82,7 +82,7 @@ bootstrap: # Some additional users users which needs to be created after initializing new cluster users: admin: - password: admin + password: admin% options: - createrole - createdb