Re: Disable script execution in server level when updating via grids

From: Filip Sedlak <filip(at)sedlakovi(dot)org>
To: arun chirappurath <arunsnmimt(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Disable script execution in server level when updating via grids
Date: 2023-12-08 08:07:08
Message-ID: 6a1995fe-a2e5-4c47-8fea-520cd56e6925@sedlakovi.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dave Cramer 2023-12-08 14:01:07 Re: Emitting JSON to file using COPY TO
Previous Message arun chirappurath 2023-12-08 06:16:28 Disable script execution in server level when updating via grids