pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Filip Sedlak <filip@sedlakovi.org>
To: arun chirappurath <arunsnmimt@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Disable script execution in server level when updating via grids
Date: Fri, 8 Dec 2023 09:07:08 +0100
Message-ID: <6a1995fe-a2e5-4c47-8fea-520cd56e6925@sedlakovi.org> (raw)
In-Reply-To: <CAA23SdvMzDcBHGyH+0zscaDEtGW_2-r0RYLXqTwY+7JEsa5baQ@mail.gmail.com>
References: <CAA23SdvMzDcBHGyH+0zscaDEtGW_2-r0RYLXqTwY+7JEsa5baQ@mail.gmail.com>

I'd use different users or roles for that - one with more restricted 
rights. I'm not sure how to do it in your specific client.

In general, your user can be granted be granted read-only access and a 
more powerful role to which it can switch explicitly.

mydb=> CREATE TABLE x (id INT);
ERROR:  permission denied for schema public
LINE 1: CREATE TABLE x (id INT);
                      ^
mydb=> SET ROLE powerful;
SET
mydb=> CREATE TABLE x (id INT);
CREATE TABLE

In PostgreSQL up to 15, you have to set "NOINHERIT" to your user so you 
don't automatically get all the privileges on login. In 16, you can set 
INHERIT FALSE when granting the role.

--
Filip Sedlák





view thread (2+ messages)

Message-ID: <6a1995fe-a2e5-4c47-8fea-520cd56e6925@sedlakovi.org>
Permalink:  ../6a1995fe-a2e5-4c47-8fea-520cd56e6925@sedlakovi.org/
Also on:    postgresql.org/message-id/6a1995fe-a2e5-4c47-8fea-520cd56e6925@sedlakovi.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: filip@sedlakovi.org, arunsnmimt@gmail.com
  Subject: Re: Disable script execution in server level when updating via grids
  In-Reply-To: <6a1995fe-a2e5-4c47-8fea-520cd56e6925@sedlakovi.org>
  References: <CAA23SdvMzDcBHGyH+0zscaDEtGW_2-r0RYLXqTwY+7JEsa5baQ@mail.gmail.com> <6a1995fe-a2e5-4c47-8fea-520cd56e6925@sedlakovi.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox