Re: Making subscribers read only in Postgres 10 logical replication

From: Feike Steenbergen <feikesteenbergen(at)gmail(dot)com>
To: rverghese <riyav(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Making subscribers read only in Postgres 10 logical replication
Date: 2017-10-17 06:01:02
Message-ID: CAK_s-G0_n6KTzZLWJ+RjUvR4t8ktqG6hDeEtWnq1u7k1v8T7eg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11 October 2017 at 20:38, rverghese <riyav(at)hotmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Allan Kamau 2017-10-17 06:06:59 Preventing psql from attempting to access ~/.pgpass file.
Previous Message Michael Paquier 2017-10-17 04:54:54 Re: wal_retrieve_retry_interval