Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIyi5-0005LD-Jj for pgsql-general@arkaria.postgresql.org; Sun, 26 Nov 2017 15:19:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eIyi3-0001nZ-IJ for pgsql-general@arkaria.postgresql.org; Sun, 26 Nov 2017 15:19:07 +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.84_2) (envelope-from ) id 1eIyi3-0001nI-AW; Sun, 26 Nov 2017 15:19:07 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eIyhw-0008PU-0f; Sun, 26 Nov 2017 15:19:06 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id CA932469FA; Sun, 26 Nov 2017 16:18:57 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id WATjwuhY8jLJ; Sun, 26 Nov 2017 16:18:55 +0100 (CET) Message-ID: <1511709533.2396.5.camel@cybertec.at> Subject: Re: Roles and security From: Laurenz Albe To: nikhil raj , pgsql-jobs@postgresql.org, pgsql-sql@postgresql.org, pgsql-admin@postgresql.com, pgsql-novice@postgresql.org, pgsql-general@postgresql.org Date: Sun, 26 Nov 2017 16:18:53 +0100 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk nikhil raj wrote: > Currently my company is shifting from MS SQL to postgres > > check the roles of user I want to give user roles only select, insert, update, execute and create database to all users Permission > > > The users should not have these permission > drop database , delete table permission If you want to allow a user (or role) CREATE DATABASE, give them the CREATEDB privilege with ALTER ROLE. If you mean "schema" when you say "database", give them the CREATE privilege on the database instead. SELECT, INSERT, UPDATE and EXECUTE are granted on individual objects, not in general. You can, however, use ALTER DEFUALT PRIVILEGES to automatically grant privieges on any new object created. Note that by default, everybody (the special role PUBLIC) has EXECUTE privilege on all functions. Only superusers and object owners are allowed DROP and ALTER on objects, and there is no way to prevent that. Yours, Laurenz Albe