Skip to content

feat(synth): enable RLS support on views with security_invoker#30

Open
rlindgren wants to merge 1 commit into
timescale:mainfrom
rlindgren:feature/rls-support
Open

feat(synth): enable RLS support on views with security_invoker#30
rlindgren wants to merge 1 commit into
timescale:mainfrom
rlindgren:feature/rls-support

Conversation

@rlindgren
Copy link
Copy Markdown

This PR provides support for RLS for views with Postgres backing tables.

Set security_invoker = true on generated views so that Row-Level Security policies on backing tables are evaluated as the querying user, not the view owner. Without this, RLS is silently bypassed when queries go through the view.

This is safe for all deployments: when RLS is not enabled on the backing table, security_invoker has no effect. Backing tables are standard PostgreSQL tables (not hypertables), so RLS is fully supported on all data tables.

Although RLS is not strictly supported, this seemed like a freebie to maintain implicit support for it. I know that the spec says Postgres 12+ support, but I believe there is some code that already sets the floor at 15+ in practice, specifically: NULLS NOT DISTINCT

Set security_invoker = true on generated views so that Row-Level
Security policies on backing tables are evaluated as the querying
user, not the view owner. Without this, RLS is silently bypassed
when queries go through the view.

This is safe for all deployments: when RLS is not enabled on the
backing table, security_invoker has no effect. Backing tables are
standard PostgreSQL tables (not hypertables), so RLS is fully
supported on all data tables.
@rlindgren rlindgren force-pushed the feature/rls-support branch from ce3431a to 5e82563 Compare April 29, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant