Re: [GENERAL] Allow only certain query on replication slave

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [GENERAL] Allow only certain query on replication slave
Дата
Msg-id CAB7nPqQaNyi+Bp==g-wO8=1gwV6=0MJVhmX0Qe_4gm=VvOgdGA@mail.gmail.com
обсуждение исходный текст
Ответ на [GENERAL] Allow only certain query on replication slave  (basti <mailinglist@unix-solution.de>)
Список pgsql-general
On Tue, Oct 24, 2017 at 6:12 AM, basti <mailinglist@unix-solution.de> wrote:
> I have a Postgres slave (wal replication) and want no query on it, expect
>
> - SELECT pg_last_xlog_receive_location()
> - SELECT pg_last_xlog_replay_location()
>
> When I set hot_standby = off in postgres.conf nobody can query the
> replication cluster.
>
> Is there a way to allow only the above query and deny all other?

There is a trick you could use here with two hooks: the planner hook
and the utility hook. The idea is to filter all queries and refuse
them when RecoveryInProgress() is satisfied. The parsed tree can be
used in the planner hook to check for those functions and accept them.
-- 
Michael


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: basti
Дата:
Сообщение: [GENERAL] Allow only certain query on replication slave
Следующее
От: Celia McInnis
Дата:
Сообщение: Re: [GENERAL] using conda environment for plpython3u?