From: Karsten Hilbert <Karsten.Hilbert@gmx.net>
To: Vijaykumar Jain <vijaykumarjain.github@gmail.com>
Cc: pgsql-general <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 19:47:09 +0200
Message-ID: <YM9/HctuxEMK/REa@hermes.hilbert.loc> (raw)
In-Reply-To: <CAM+6J94cbMKJFU+mEJCKQte_dWJ7b3ZAyMTRv8Sontod=EmPgA@mail.gmail.com>
References: <YM9xKBUhojhlOLuP@hermes.hilbert.loc>
<CAM+6J94cbMKJFU+mEJCKQte_dWJ7b3ZAyMTRv8Sontod=EmPgA@mail.gmail.com>
Dear Jain,
> Did I simulate your concern correctly ?
Nearly so, to my understanding. What you did (and thanks for
the followup) was ...
> postgres@db:~/playground/logical_replication$ rm -rf example
> postgres@db:~/playground/logical_replication$ initdb -D example 2>/dev/null
> >/dev/null
> postgres@db:~/playground/logical_replication$ vim example/postgresql.conf
> postgres@db:~/playground/logical_replication$ printf
> "default_transaction_read_only=on\n" >> example/postgresql.conf #global
> config setting as on
... to tell the server to *treat* all databases in the
cluster as readonly. IOW, an intent rather than a property of
_a_ database (ALTER DATABASE ...).
Consequently, ...
> postgres@db:~/playground/logical_replication$ pg_ctl -D example -l logfile
> start
> waiting for server to start.... done
> server started
> postgres@db:~/playground/logical_replication$ psql
> psql (14beta1)
> Type "help" for help.
>
> postgres=# show default_transaction_read_only; -- validate it is on
> default_transaction_read_only
> -------------------------------
> on
> (1 row)
>
> postgres=# \q
> postgres@db:~/playground/logical_replication$ pg_dumpall -f dump.sql
... when the properties get dumped ...
> postgres@db:~/playground/logical_replication$ grep
> default_transaction_read_only dump.sql -- check what gets dumped
> SET default_transaction_read_only = off;
... the dump does not contain the "on" setting (because, I
assume, it does not dump configuration of the server, but
content and properties of databases).
Still, thanks for thinking along.
Best,
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
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: Karsten.Hilbert@gmx.net, vijaykumarjain.github@gmail.com
Subject: Re: pg_dump/pg_restore vs default_transaction_read_only under PG 13.2
In-Reply-To: <YM9/HctuxEMK/REa@hermes.hilbert.loc>
References: <YM9xKBUhojhlOLuP@hermes.hilbert.loc> <CAM+6J94cbMKJFU+mEJCKQte_dWJ7b3ZAyMTRv8Sontod=EmPgA@mail.gmail.com> <YM9/HctuxEMK/REa@hermes.hilbert.loc>
* 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