Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2
Date: 2021-06-20 20:14:06
Message-ID: 3d842ba4-13c1-cd95-8ef9-b69a06eeb6c1@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2021-06-20 20:40:38 Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2
Previous Message Karsten Hilbert 2021-06-20 19:58:52 Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2