diff --git a/doc/src/sgml/ref/pg_rewind.sgml b/doc/src/sgml/ref/pg_rewind.sgml index ee35ce18b08..670371e0dfc 100644 --- a/doc/src/sgml/ref/pg_rewind.sgml +++ b/doc/src/sgml/ref/pg_rewind.sgml @@ -153,10 +153,12 @@ PostgreSQL documentation Specifies a libpq connection string to connect to the source - PostgreSQL server to synchronize the target with. - The connection must be a normal (non-replication) connection - with superuser access. This option requires the source - server to be running and not in recovery mode. + PostgreSQL server to synchronize the target + with. The connection must be a normal (non-replication) connection + with a role having sufficient permissions to execute the functions + used by pg_rewind on the source server + (see Notes section for details) or a superuser role. This option + requires the source server to be running and not in recovery mode. @@ -221,6 +223,30 @@ PostgreSQL documentation Notes + + When executing pg_rewind using an online + cluster as source, a role having sufficient permissions to execute the + functions used by pg_rewind on the source + cluster can be used instead of a superuser. Here is how to create such + a role, named rewind_user here: + +CREATE USER rewind_user LOGIN; +GRANT EXECUTE ON function pg_catalog.pg_ls_dir(text, boolean, boolean) TO rewind_user; +GRANT EXECUTE ON function pg_catalog.pg_stat_file(text, boolean) TO rewind_user; +GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text) TO rewind_user; +GRANT EXECUTE ON function pg_catalog.pg_read_binary_file(text, bigint, bigint, boolean) TO rewind_user; + + + + + When executing pg_rewind using an online + cluster as source which has been recently promoted, it is necessary + to execute a CHECKPOINT after promotion so as its + control file reflects up-to-date timeline information, which is used by + pg_rewind to check if the target cluster + can be rewound using the designated source cluster. + + How it works