pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
RESTRICT TABLE OWNER NOT TO DELETE IT
3+ messages / 3 participants
[nested] [flat]

* RESTRICT TABLE OWNER NOT TO DELETE IT
@ 2021-03-08 11:23  Peter Wainaina <petwah17@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Peter Wainaina @ 2021-03-08 11:23 UTC (permalink / raw)
  To: pgsql-admin@lists.postgresql.org

Hi
i need help on how to restrict the table owner no to drop/truncate the table

Data Engineer | Database Developer| Business Analyst
Mobile: (+254)-708-747-053

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: RESTRICT TABLE OWNER NOT TO DELETE IT
@ 2021-03-08 13:47  Greg Spiegelberg <gspiegelberg@gmail.com>
  parent: Peter Wainaina <petwah17@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Greg Spiegelberg @ 2021-03-08 13:47 UTC (permalink / raw)
  To: Peter Wainaina <petwah17@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org

On Mon, Mar 8, 2021 at 4:24 AM Peter Wainaina <petwah17@gmail.com> wrote:

> Hi
> i need help on how to restrict the table owner no to drop/truncate the
> table
>

Believe you are looking for Event Triggers.
https://www.postgresql.org/docs/12/event-trigger-example.html

-Greg

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: RESTRICT TABLE OWNER NOT TO DELETE IT
@ 2021-03-08 15:58  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Wainaina <petwah17@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2021-03-08 15:58 UTC (permalink / raw)
  To: Peter Wainaina <petwah17@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org

Peter Wainaina <petwah17@gmail.com> writes:
> i need help on how to restrict the table owner no to drop/truncate the table

As far as Postgres is concerned, "can drop the object" is pretty much
the definition of ownership.  Maybe you need to rethink who owns which
tables in your design.  (Yes, you could use event triggers to interfere
with the normal system behavior, but that doesn't make it a good idea.)

The owner can revoke her own TRUNCATE privilege, but that's just a
mistake preventer, since she can also re-grant the privilege to herself.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2021-03-08 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 11:23 RESTRICT TABLE OWNER NOT TO DELETE IT Peter Wainaina <petwah17@gmail.com>
2021-03-08 13:47 ` Greg Spiegelberg <gspiegelberg@gmail.com>
2021-03-08 15:58 ` Tom Lane <tgl@sss.pgh.pa.us>

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