Re: [GENERAL] Making subscribers read only in Postgres 10 logical replication - Mailing list pgsql-general

From Feike Steenbergen
Subject Re: [GENERAL] Making subscribers read only in Postgres 10 logical replication
Date
Msg-id CAK_s-G0_n6KTzZLWJ+RjUvR4t8ktqG6hDeEtWnq1u7k1v8T7eg@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] Making subscribers read only in Postgres 10 logical replication  (rverghese <riyav@hotmail.com>)
List pgsql-general
On 11 October 2017 at 20:38, rverghese <riyav@hotmail.com> wrote:
> I guess there is nothing at the database level.

Although not safe (as the user can reset this parameter), you could set
default_transaction_read_only for the application user.


postgres=# ALTER USER jdoe IN DATABASE postgres SET default_transaction_read_only TO true;
ALTER ROLE
postgres=# \c postgres jdoe
You are now connected to database "postgres" as user "jdoe".
postgres=> CREATE TABLE t1(i int);
ERROR:  cannot execute CREATE TABLE in a read-only transaction

regards,

Feike

pgsql-general by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [GENERAL] wal_retrieve_retry_interval
Next
From: Allan Kamau
Date:
Subject: [GENERAL] Preventing psql from attempting to access ~/.pgpass file.