Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YqNOh-0003cB-7K for pgsql-admin@arkaria.postgresql.org; Thu, 07 May 2015 15:07:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YqNOg-0006nO-K9 for pgsql-admin@arkaria.postgresql.org; Thu, 07 May 2015 15:07:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YqNOf-0006nI-QZ for pgsql-admin@postgresql.org; Thu, 07 May 2015 15:07:33 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1YqNOY-000697-LL for pgsql-admin@postgresql.org; Thu, 07 May 2015 15:07:32 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 14F5A5F7A3; Thu, 7 May 2015 11:07:26 -0400 (EDT) Date: Thu, 7 May 2015 11:07:26 -0400 From: Stephen Frost To: "Markova, Nina" Cc: "pgsql-admin@postgresql.org" Subject: Re: where table privileges are stored Message-ID: <20150507150725.GB30322@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="OaJtNTxAPudgaAxc" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-46-generic (x86_64) X-Uptime: 11:05:49 up 48 days, 20:54, 26 users, load average: 0.09, 0.10, 0.12 User-Agent: Mutt/1.5.21 (2010-09-15) 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 --OaJtNTxAPudgaAxc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Nina, * Markova, Nina (Nina.Markova@NRCan-RNCan.gc.ca) wrote: > I need to check in a GUI if a user has certain privileges on the table he= is trying to modify - insert/update/delete. You probably want to use the "has_table_privilege" family of functions. Look here: http://www.postgresql.org/docs/9.4/static/functions-info.html > Something I could query system catalogs about: > Select ... from ... where table_name =3D 'MYTABLE'; >=20 > Does Postgres store user privileges on tables in format similar to the on= e below, I mean the info below to be stored as a text field somewhere? > grant delete on MYTABLE to myuser > grant insert on MYTABLE to myuser Privileges are stored in the catalog tables but not is a terribly useful format for querying, which is why the helper functions exist. If you want to look at it though, look at pg_class.relacl. Thanks! Stephen --OaJtNTxAPudgaAxc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJVS3+tAAoJEO1sijiDR2RVeKoQAIzRG9cu/3+ePYDs33WhDv0W h0ZWBjwuPrVvZq733yS9B6cR+RVMGi3HidEpVO1GvIfL/IwsEW+ZGJgv2JzAmKQf dEWg0dZJy3YPiobY5Q4Ww2anujVLAqALfMG6Z3B+j7JHSB0a+HCh9QUoA3CGJdij gHHllGJ+d8FhPeIG0gCSHrvE5QMFgjPh7dIP7mvEkdpFLswxWL6BEFjGaw+Co6Pf Q8rtzdR81FROZcFJhhnHGZAypUHq+f4gwNBAj29hfmQ8r2Rs0lcUFHpt2JEm5mv7 LqjWwhx/k9TUsirKZukxnBir5LmFPXnF8pkS3YbFUCN9zIJxOgXqtGRBUXTJ+DeI xKLa4R/2VPk4H2QtSKYa052ZBljQB3Bo+W15wlgXTgVtv/x22ET8E9zspn1MM0fl rh9zLiG30X0O0nsghCVq7WdsfiyVOYFGerv9Fut7DVAQeg6f/IwCkx2JEHPu8od/ 5iYhpGZbDyidyKxHhXCwsPLhsNoTpj8zkyWqZdRbhE77hz5y0c3YftQKEtGCU8DK GRuOU1QOgK1rmyuluaQt2b0eJ8QabJNWhsH4KCxPl6yEATsbIi8NjHw6FarIKLua UhqvEO2or8aSDjzVpxVGRLvgVFgwZEFb2GoBu7WcZuc3raNroH3szD3wt1gW9B+0 SfNnwa+GWWcaxvByXsr7 =AySk -----END PGP SIGNATURE----- --OaJtNTxAPudgaAxc--