mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Synchronous commit is disabled for rewind user GRANTs (#1145)
SET local synchronous_commit = 'local' before running GRANT
This commit is contained in:
committed by
Alexander Kukushkin
parent
0f7c8b7b09
commit
e9a5d25ef3
@@ -344,8 +344,12 @@ END;$$""".format(name, ' '.join(options))
|
||||
self.create_or_update_role(rewind['username'], rewind.get('password'), [])
|
||||
for f in ('pg_ls_dir(text, boolean, boolean)', 'pg_stat_file(text, boolean)',
|
||||
'pg_read_binary_file(text)', 'pg_read_binary_file(text, bigint, bigint, boolean)'):
|
||||
postgresql.query('GRANT EXECUTE ON function pg_catalog.{0} TO "{1}"'
|
||||
.format(f, rewind['username']))
|
||||
sql = """DO $$
|
||||
BEGIN
|
||||
SET local synchronous_commit = 'local';
|
||||
GRANT EXECUTE ON function pg_catalog.{0} TO "{1}";
|
||||
END;$$""".format(f, rewind['username'])
|
||||
postgresql.query(sql)
|
||||
|
||||
for name, value in (config.get('users') or {}).items():
|
||||
if all(name != a.get('username') for a in (superuser, replication, rewind)):
|
||||
|
||||
Reference in New Issue
Block a user