Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiK3I-0002JD-3F for pgsql-admin@arkaria.postgresql.org; Wed, 25 Jul 2018 13:42:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fiK3G-0001OR-DJ for pgsql-admin@arkaria.postgresql.org; Wed, 25 Jul 2018 13:42:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiK3G-0001OK-5m for pgsql-admin@lists.postgresql.org; Wed, 25 Jul 2018 13:42:02 +0000 Received: from mailout.easymail.ca ([64.68.200.34]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiK3C-0003i9-Ng for pgsql-admin@postgresql.org; Wed, 25 Jul 2018 13:42:01 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 18842C0B0C; Wed, 25 Jul 2018 13:41:56 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo01-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x2M1Mf6f8WCp; Wed, 25 Jul 2018 13:41:56 +0000 (UTC) Received: from [192.168.2.16] (unknown [8.39.228.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 616B4C08B3; Wed, 25 Jul 2018 13:41:53 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.4 \(3445.8.2\)) Subject: Re: Granting any privilege for a specific set of tables in postgres in a single shot!.. From: Scott Ribe In-Reply-To: <1532525538301-0.post@n3.nabble.com> Date: Wed, 25 Jul 2018 07:41:52 -0600 Cc: pgsql-admin@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <84DC1576-3D76-40B9-83D5-F6579B62F264@elevated-dev.com> References: <1532525538301-0.post@n3.nabble.com> To: pavan95 X-Mailer: Apple Mail (2.3445.8.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 3 suggestions - use roles so you don't have to grant to so many individual users - use schemas so you don't have to grant to individual tables - select 'grant select on ' || ? || ' to ' || ?, into a script which you = then execute -- Scott Ribe scott_ribe@elevated-dev.com https://www.linkedin.com/in/scottribe/ > On Jul 25, 2018, at 7:32 AM, pavan95 = wrote: >=20 > Hi all, >=20 > Hope my mail finds you in good time. I have a question in regards to > "Grant" command.=20 >=20 > How can I grant a particular privilege to a specific set of = objects(tables) > in a single shot ? >=20 > FYI, please consider the following scenario. I have a database "abc" = with > users as "u1","u2","u3","u4". And there are 1500 tables in my = database. >=20 > Now my requirement is to grant select on 800 tables(specific set of = tables) > which suits my requirement. I know that I can use the below statement = 800 > times. >=20 > grant select on table1 to u1; > grant select on table2 to u1; > . > . > . > . > . > . > grant select on table800 to u1; >=20 > My question is can't I do it in a single shot? Can I fit some select = query > which passes the table name as a parameter in the middle of the grant > statement? >=20 > Please advice. >=20 > Thanks in Advance. >=20 > Regards, > Pavan >=20 >=20 >=20 >=20 >=20 > -- > Sent from: = http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html >=20