Re: PostgreSQL 17: RLS, SECURITY DEFINER and migration role safety questions

From: Dominique Devienne <ddevienne(at)gmail(dot)com>
To: Samir Gadzhiev <mr(dot)sperrow111(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL 17: RLS, SECURITY DEFINER and migration role safety questions
Date: 2026-10-13 11:28:46
Message-ID: CAFCRh--i88kbdJ0ZbUu6nx803Zw0_1DHitPgjXr+xtmXHvvgZw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 13, 2026 at 11:45 AM Samir Gadzhiev <mr(dot)sperrow111(at)gmail(dot)com> wrote:
> One question, if you don't mind: would you generally recommend a dedicated schema for all privileged SECURITY DEFINER functions, or separate schemas for different security domains, such as authentication, sessions, and document access?

I would err on the side of granularity.

With too many SCHEMAs, it's easy to GRANT ... ON ALL ROUTINES IN
SCHEMA + GRANT USAGE ON SCHEMA.

While with too few, you're back to having to deal with per-routine
GRANTs, i.e. many more I suspect. If you have fewer security domains
than routines, that is, of course. You lose the benefit of SCHEMA-wide
granting.

For routines, SCHEMAs replace Oracle's packages.

Note that one thing I really miss from Oracle is the ability to grant
something to a particular routine (and not a role).

But TBH, I hope someone more experienced than me would chime as well :)
My uses of PostgreSQL is definitely not mainstream I fear. --DD

In response to

Browse pgsql-general by date

  From Date Subject
Next Message 2026-10-13 11:36:48 AW: Why is materialized view creation a "security-restricted operation"?
Previous Message Laurenz Albe 2026-10-13 11:10:05 Re: AW: pg_event_trigger_ddl_commands after GRANT is quite empty