Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlYTb-000076-8A for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2020 13:51:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlYTa-0000PD-1K for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Jun 2020 13:51:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jlYTZ-0000P6-N9 for pgsql-hackers@lists.postgresql.org; Wed, 17 Jun 2020 13:51:37 +0000 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jlYTW-0002sp-R7 for pgsql-hackers@postgresql.org; Wed, 17 Jun 2020 13:51:36 +0000 Received: by mail-qv1-xf44.google.com with SMTP id x16so1036275qvr.3 for ; Wed, 17 Jun 2020 06:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=mWp7uMuUmvz24z1RIfsro1PRRj3LH1qYHBJU6bLZbRM=; b=SzZ64TZuruPa+DF/yR02gSk0Gmw49kDvxORIY/xoN9rDiSVMzYQMPkd+70D6QlEVDl LHwAjvwc0ZI7xU2H+ueGRmdazwVbcCH0gt+rkaMWjZN+AP+9rVBG5q/bKx5wGonD7TAF bxsCWNab5el+ETrX15MO8jK52EdrJKqNi9wkC9uON3VRfKcCzOU/XUiHmK/l3mS+r3sM aC8WEIPNcMKVz66DR4R79X2v5jqIH1FD6Bc9LRdZJtRzJhqjLwCBGkrSUhHquZtJH9b5 NJ/a7asBeVsZXWz0gtoKxXO2MbDLJ2055CB0OBjsYqn07v3IvbXgIZLpS9fjcFPJ/+mO 32KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=mWp7uMuUmvz24z1RIfsro1PRRj3LH1qYHBJU6bLZbRM=; b=o1rO5VgUbSyr6i2xwG1xswPy1rV8z6kfT5otHpSLRHakYKwxqCDYpV5iNt4PVQWtre WJXmzuX7t5TmicAboFw8xVPp8RBSNSeXQGHmSxzkoE71IL3INqSSTLkSL+DPQoF7kZ4L P7ILQca933T67/c48z9jIxZ1LXYaMV/YUwxywUiMBjrS3044VZb0YskYakFEW8+1/PmJ 29m+VU5opZZxzPtN/XppdlOT2JhRICqQ+K6r9HqGNPF/cWd645M0gmJx9jpNv0moL3jw woab/oY0f8tvIfSgylOBHKpojJp4npxnQXHc7gi6Vj1RCBHdrAqq5iyt4g+mt8dHVByy p2AA== X-Gm-Message-State: AOAM533tqQ8DOspmZV1LHF5IiWeIcK0pfvXwDpJfO/ODPXeu9VLhqdq+ QREe1L6TGphUi+5UlGQWt2FlVpcDfm/5RpcskqekNoN6rvPeGwtty1UccFpHiTr28kumn2YrQph VIqckhUnCXxLT52zyOueMlt3lc19c62uAcPVMBLe7WKtkBF2wjIxokafMYLjQmZowQogoywNZ+d LerqiTAb+wrKAZoqXETpnt52hB5nCoFuPz1IUvDU9vb30npgbXoBxcS53QOJ8qSpiUEdL0cnBB1 aQHFKY6NiCgKIP60sk+cIozVnBmQ6PAWvQ= X-Google-Smtp-Source: ABdhPJy7PWZztrvZcoiOWdsSPeSBek+UrKe6bDnwAbabdnRGs07DmMTUqEOp3xbapXtbCUe8Pxw7ng== X-Received: by 2002:a0c:e9cd:: with SMTP id q13mr7808266qvo.23.1592401893355; Wed, 17 Jun 2020 06:51:33 -0700 (PDT) Received: from localhost.localdomain ([49.35.217.35]) by smtp.gmail.com with ESMTPSA id d16sm19712024qte.49.2020.06.17.06.51.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Jun 2020 06:51:32 -0700 (PDT) Subject: Re: [Patch] ALTER SYSTEM READ ONLY To: amul sul , PostgreSQL-development References: From: tushar Message-ID: Date: Wed, 17 Jun 2020 19:21:18 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/16/20 7:25 PM, amul sul wrote: > Attached patch proposes $Subject feature which forces the system into > read-only > mode where insert write-ahead log will be prohibited until ALTER > SYSTEM READ > WRITE executed. Thanks Amul. 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' ; " so that ALTER SYSTEM command syntax should be same for all. postgres=# \h alter system Command:     ALTER SYSTEM Description: change a server configuration parameter Syntax: ALTER SYSTEM SET configuration_parameter { TO | = } { value | 'value' | DEFAULT } ALTER SYSTEM RESET configuration_parameter ALTER SYSTEM RESET ALL How we are going to justify this in help command of ALTER SYSTEM ? 2)When i connected to postgres in a single user mode , i was not able to set the system in read only [edb@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> -- regards,tushar EnterpriseDB https://www.enterprisedb.com/ The Enterprise PostgreSQL Company