Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YcwWc-00059L-Nr for pgsql-admin@arkaria.postgresql.org; Tue, 31 Mar 2015 13:48:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YcwWb-0003wI-VP for pgsql-admin@arkaria.postgresql.org; Tue, 31 Mar 2015 13:48:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YcwWb-0003w6-45 for pgsql-admin@postgresql.org; Tue, 31 Mar 2015 13:48:13 +0000 Received: from imx3.etecsa.cu ([200.55.152.137]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YcwWW-0005yG-0K for pgsql-admin@postgresql.org; Tue, 31 Mar 2015 13:48:12 +0000 Received: from Unknown ([192.168.91.45] helo=mn3.etecsa.cu) by imx3.etecsa.cu with ESMTP id t8l28m4Y47037; Tue, 31 Mar 2015 08:47:02 -0500 Received: (qmail 11313 invoked by uid 11185); 31 Mar 2015 14:47:46 -0000 Received: from 192.168.91.6 by mn3.etecsa.cu (envelope-from , uid 502) with qmail-scanner-2.08 (spamassassin: 3.2.5. Clear:RC:1(192.168.91.6):. Processed in 0.021873 secs); 31 Mar 2015 14:47:46 -0000 Received: from unknown (HELO webmail.etecsa.cu) ([192.168.91.6]) (envelope-sender ) by mn2.etecsa.cu (qmail-ldap-1.03) with SMTP for ; 31 Mar 2015 14:47:46 -0000 Received: from 192.168.207.54 (SquirrelMail authenticated user gilberto.castillo) by webmail.etecsa.cu with HTTP; Tue, 31 Mar 2015 09:47:45 -0500 (GMT+5) Message-ID: <46016.192.168.207.54.1427813265.squirrel@webmail.etecsa.cu> In-Reply-To: <20150331134440.GL3663@tamriel.snowman.net> References: <20150331131252.GI3663@tamriel.snowman.net> <45998.192.168.207.54.1427812184.squirrel@webmail.etecsa.cu> <20150331133130.GK3663@tamriel.snowman.net> <46009.192.168.207.54.1427812926.squirrel@webmail.etecsa.cu> <20150331134440.GL3663@tamriel.snowman.net> Date: Tue, 31 Mar 2015 09:47:45 -0500 (GMT+5) Subject: Re: Permission select pg_stat_replication From: "Gilberto Castillo" To: "Stephen Frost" Cc: "Gilberto Castillo" , jesse.waters@gmail.com, pgsql-admin@postgresql.org Reply-To: gilberto.castillo@etecsa.cu User-Agent: SquirrelMail/1.4.8-5.el5_4.10 MIME-Version: 1.0 X-Priority: 3 (Normal) Importance: Normal X-SpamTest-Envelope-From: gilberto.castillo@etecsa.cu X-SpamTest-Info: Profiles 72422 [Jan 28 2015] X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0285], KAS30/SDK/Release X-Anti-Virus: Kaspersky Mail Gateway, version: 5.6.28/RELEASE, bases: 20140401T050822 #7726142, check: 20150331 clean Content-Type: multipart/mixed; boundary="=t8l48K8W46045=imx3.etecsa.cu=" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org This is a multi-part message in MIME format. --=t8l48K8W46045=imx3.etecsa.cu= Content-Disposition: inline Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit > Gilberto, > > * Gilberto Castillo (gilberto.castillo@etecsa.cu) wrote: >> > * Gilberto Castillo (gilberto.castillo@etecsa.cu) wrote: >> >> > * jesse.waters@gmail.com (jesse.waters@gmail.com) wrote: >> >> >> Could someone tell me what permission is required to >> >> >> select * from pg_stat_replication; ? >> >> > >> >> > Currently, you're required to have superuser rights. >> >> > >> >> >> I like to setup a monitor to query database with minimal >> privileges >> >> >> necessary. >> >> > >> >> > I agree 110% and am actively working to fix exactly this issue. I >> >> hope >> >> > to have a patch in the next day or so which will allow you to GRANT >> >> > rights to such a monitor user which will allow that user to see all >> >> the >> >> > contents of pg_stat_replication. >> >> > >> >> > One thing which would be really great is if you have time to test >> with >> >> > the patch I'm working up (it's against 9.5, but this is strictly >> >> > functionality testing and should be just in in a dev/test >> environment, >> >> > I wouldn't suggest running 9.5 in production, of course!). >> > [...] >> >> SET SESSION AUTHORIZATION postgres; >> >> >> >> GRANT SELECT ON pg_stat_replication TO usuario1; >> > >> > This is (essentially) what I'm hoping to enable. Note that this won't >> > do anything for you today as the view is already available to all >> users >> > on the system and it's actually the function underneath which is >> > filtering the result set. >> >> ALTER DEFAULT PRIVILEGES FOR ROLE postgres GRANT SELECT ON VIEWS TO >> usuario1; >> >> Nor does it work? > > No. Feel free to try, but there's an explicit check in the C code which > is what the SQL-level function that's under the view is calling. In > current 9.5/master, at least, it's at: > > src/backend/replication/walsender.c:2797 > > if (!superuser()) > { > /* > * Only superusers can see details. Other users only get the > pid > * value to know it's a walsender, but no details. > */ > MemSet(&nulls[1], true, PG_STAT_GET_WAL_SENDERS_COLS - 1); > } > Thanks Stephen for you information. Rgds, Gilberto Castillo La Habana, Cuba --=t8l48K8W46045=imx3.etecsa.cu= Content-Type: text/plain Content-Disposition: inline --- This message was processed by Kaspersky Mail Gateway 5.6.28/RELEASE running at host imx3.etecsa.cu Visit our web-site: , --=t8l48K8W46045=imx3.etecsa.cu= Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin --=t8l48K8W46045=imx3.etecsa.cu=--