Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 93B16B5DBFC for ; Sat, 9 Jul 2011 09:26:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 78029-02 for ; Sat, 9 Jul 2011 12:26:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd-17937.dedibox.fr (sd-17937.dedibox.fr [88.191.100.74]) by mail.postgresql.org (Postfix) with ESMTP id 5B699B5DBC4 for ; Sat, 9 Jul 2011 09:26:47 -0300 (ADT) Received: from [192.168.10.3] (ASte-Genev-Bois-153-1-21-176.w83-112.abo.wanadoo.fr [83.112.201.176]) by sd-17937.dedibox.fr (Postfix) with ESMTPA id 38C533B8F5; Sat, 9 Jul 2011 14:26:47 +0200 (CEST) Subject: Re: How to start a database in ReadOnly mode? From: Guillaume Lelarge To: Greg Sabino Mullane Cc: pgsql-admin@postgresql.org Date: Sat, 09 Jul 2011 14:26:46 +0200 In-Reply-To: <5fe0d78bda51d7176940fb8e78739b54@biglumber.com> References: <5fe0d78bda51d7176940fb8e78739b54@biglumber.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.0.2 (3.0.2-3.fc15) Content-Transfer-Encoding: 7bit Message-ID: <1310214407.2101.36.camel@laptop> Mime-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201107/56 X-Sequence-Number: 37835 On Sat, 2011-07-09 at 11:58 +0000, Greg Sabino Mullane wrote: > > Is it possible to start a postgres cluster or 1 postgres database in > > readonly mode? And - if yes - how can this be done? > > Clusterwide: edit postgresql.conf and set > default_transaction_read_only = on; > > No restart needed, just a reload (HUP) > > Database-wide: > > ALTER DATABASE foobar SET default_transaction_read_only = true; > The only issue is that any user can unset this parameter with a SET query on his session. -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com