Add SECURITY_INVOKER_VIEWS option to CREATE DATABASE

From: Steve Chavez <steve(at)supabase(dot)io>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Add SECURITY_INVOKER_VIEWS option to CREATE DATABASE
Date: 2026-01-27 16:36:51
Message-ID: CAGRrpzZUXvj=KVspvX301Uo1NpVWQ4aCjHJ9+0zE22TJd5Z1vA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

Currently views are not secure by default since they bypass RLS. PostgreSQL
15 introduced the `WITH (security_invoker = true)` option for this but it's
easy to miss on every new view created.

It's also inconsistent with functions, which default to SECURITY INVOKER.

I propose adding an option: `CREATE DATABASE .. SECURITY_INVOKER_VIEWS
<bool>` (false by default to maintain backwards compat), so a database will
have newly created views as SECURITY INVOKER.

Let me know what you think.

Best regards,
Steve Chavez

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2026-01-27 16:37:56 Re: pgsql: Prevent invalidation of newly synced replication slots.
Previous Message Srirama Kucherlapati 2026-01-27 16:21:12 RE: AIX support