pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Karsten Hilbert <Karsten.Hilbert@gmx.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2
Date: Sun, 20 Jun 2021 13:14:06 -0700
Message-ID: <3d842ba4-13c1-cd95-8ef9-b69a06eeb6c1@aklaver.com> (raw)
In-Reply-To: <YM+YVXfEZyRP9PLl@hermes.hilbert.loc>
References: <YM9xKBUhojhlOLuP@hermes.hilbert.loc>
	<1511776.1624211267@sss.pgh.pa.us>
	<YM+YVXfEZyRP9PLl@hermes.hilbert.loc>

On 6/20/21 12:34 PM, Karsten Hilbert wrote:
> Am Sun, Jun 20, 2021 at 01:47:47PM -0400 schrieb Tom Lane:
> 
>> Hence, the only way to make this scenario work would be for the
>> restore script to explicitly override default_transaction_read_only.
> [...]
>> Also, doing so would result in ignoring default_transaction_read_only
>> no matter what the source of that was.  I think it's probably not
>> hard to construct scenarios where someone would really not be happy
>> about such behavior.
> 
> Any chance pg_dump (and/or pg_restore) might gain an option
> --ignore-read-only ?   That way, PostgreSQL need not decide
> for users.

How about:

1) pg_dump -Fc -d read_only_db -U postgres -f read_only.out

2) In new cluster:
    A) psql -d postgres -U postgres
       CREATE DATABASE read_only;

    B) pg_restore -d read_only -U postgres read_only.out

    C)  psql -d read_only -U postgres
      alter database read_only SET default_transaction_read_only TO 'on';

> 
> Thanks,
> Karsten
> --
> GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (14+ messages)  latest in thread

Message-ID: <3d842ba4-13c1-cd95-8ef9-b69a06eeb6c1@aklaver.com>
Permalink:  ../3d842ba4-13c1-cd95-8ef9-b69a06eeb6c1@aklaver.com/
Also on:    postgresql.org/message-id/3d842ba4-13c1-cd95-8ef9-b69a06eeb6c1@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, Karsten.Hilbert@gmx.net, tgl@sss.pgh.pa.us
  Subject: Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2
  In-Reply-To: <3d842ba4-13c1-cd95-8ef9-b69a06eeb6c1@aklaver.com>
  References: <YM9xKBUhojhlOLuP@hermes.hilbert.loc> <1511776.1624211267@sss.pgh.pa.us> <YM+YVXfEZyRP9PLl@hermes.hilbert.loc> <3d842ba4-13c1-cd95-8ef9-b69a06eeb6c1@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox