postgres: make interfaces of exec_sql clearer (#43)

(cherry picked from commit fb6583a15c1f7fd8e48f4f3ef214ed4e74c3d8c6)
This commit is contained in:
Andrew Klychkov 2020-03-25 14:44:28 +03:00 committed by GitHub
parent 07ecfc940c
commit 1c550cd4ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 44 additions and 45 deletions

View file

@ -192,19 +192,19 @@ class PgSlot(object):
self.changed = exec_sql(self, query,
query_params={'name': self.name, 'i_reserve': immediately_reserve},
ddl=True)
return_bool=True)
elif kind == 'logical':
query = "SELECT pg_create_logical_replication_slot(%(name)s, %(o_plugin)s)"
self.changed = exec_sql(self, query,
query_params={'name': self.name, 'o_plugin': output_plugin}, ddl=True)
query_params={'name': self.name, 'o_plugin': output_plugin}, return_bool=True)
def drop(self):
if not self.exists:
return False
query = "SELECT pg_drop_replication_slot(%(name)s)"
self.changed = exec_sql(self, query, query_params={'name': self.name}, ddl=True)
self.changed = exec_sql(self, query, query_params={'name': self.name}, return_bool=True)
def __slot_exists(self):
query = "SELECT slot_type FROM pg_replication_slots WHERE slot_name = %(name)s"