From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | tushar <tushar(dot)ahuja(at)enterprisedb(dot)com> |
Cc: | amul sul <sulamul(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [Patch] ALTER SYSTEM READ ONLY |
Date: | 2020-06-17 14:45:44 |
Message-ID: | CA+TgmoakCtzOZr0XEqaLFiMBcjE2rGcBAzf4EybpXjtNetpSVw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jun 17, 2020 at 9:51 AM tushar <tushar(dot)ahuja(at)enterprisedb(dot)com> wrote:
> 1) ALTER SYSTEM
>
> postgres=# alter system read only;
> ALTER SYSTEM
> postgres=# alter system reset all;
> ALTER SYSTEM
> postgres=# create table t1(n int);
> ERROR: cannot execute CREATE TABLE in a read-only transaction
>
> Initially i thought after firing 'Alter system reset all' , it will be
> back to normal.
>
> can't we have a syntax like - "Alter system set read_only='True' ; "
No, this needs to be separate from the GUC-modification syntax, I
think. It's a different kind of state change. It doesn't, and can't,
just edit postgresql.auto.conf.
> 2)When i connected to postgres in a single user mode , i was not able to
> set the system in read only
>
> [edb(at)tushar-ldap-docker bin]$ ./postgres --single -D data postgres
>
> PostgreSQL stand-alone backend 14devel
> backend> alter system read only;
> ERROR: checkpointer is not running
>
> backend>
Hmm, that's an interesting finding. I wonder what happens if you make
the system read only, shut it down, and then restart it in single-user
mode. Given what you see here, I bet you can't put it back into a
read-write state from single user mode either, which seems like a
problem. Either single-user mode should allow changing between R/O and
R/W, or alternatively single-user mode should ignore ALTER SYSTEM READ
ONLY and always allow writes anyway.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-06-17 14:58:15 | Re: [Patch] ALTER SYSTEM READ ONLY |
Previous Message | Robert Haas | 2020-06-17 14:41:55 | Re: [Patch] ALTER SYSTEM READ ONLY |