Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 2AAF4B5DBCA for ; Thu, 7 Jul 2011 04:50:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 98073-04 for ; Thu, 7 Jul 2011 07:49:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smadev.internal.net (host3.dynacom.ondsl.gr [62.103.35.211]) by mail.postgresql.org (Postfix) with ESMTP id 735F0B5DBCC for ; Thu, 7 Jul 2011 04:49:55 -0300 (ADT) Received: from smadev.internal.net (localhost.internal.net [127.0.0.1]) by smadev.internal.net (8.14.2/8.14.2) with ESMTP id p677ns9I033012 for ; Thu, 7 Jul 2011 10:49:54 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Received: from localhost (localhost [[UNIX: localhost]]) by smadev.internal.net (8.14.2/8.14.2/Submit) id p677nsdE033011 for pgsql-admin@postgresql.org; Thu, 7 Jul 2011 10:49:54 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) From: Achilleas Mantzios Organization: Dynacom Tankers Mgmt To: pgsql-admin@postgresql.org Subject: Re: How to start a database in ReadOnly mode? Date: Thu, 7 Jul 2011 10:49:53 +0300 User-Agent: KMail/1.9.7 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <201107071049.53956.achill@matrix.gatewaynet.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.451 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_BRBL_LASTEXT=1.449 X-Spam-Level: X-Archive-Number: 201107/42 X-Sequence-Number: 37821 Hello =CE=A3=CF=84=CE=B9=CF=82 Thursday 07 July 2011 10:26:19 =CE=BF/=CE=B7 Simon= Riggs =CE=AD=CE=B3=CF=81=CE=B1=CF=88=CE=B5: > On Thu, Jul 7, 2011 at 8:08 AM, Paul Schluck wrote: >=20 > > Is it possible to start a postgres cluster or 1 postgres database in > > readonly mode? And - if yes - how can this be done? >=20 > There is no formal, explicit command to do that. Just avoid doing > writes, either in the application or by removing privileges. >=20 This is how we did it, when there was a special requirement to do so for a = special occasion, make a new user (lets call it "readonly") and have the app authenticating w= ith this user. Manage his privileges with smth like: (for every table) CREATE user readonly; REVOKE ALL ON DATABASE FROM readonly; (for each table) GRANT SELECT ON TO readonly; =46or this last one you might need to write a script, producing the sql com= mands. > --=20 > =A0Simon Riggs=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 http= ://www.2ndQuadrant.com/ > =A0PostgreSQL Development, 24x7 Support, Training & Services >=20 =2D-=20 Achilleas Mantzios