HollaHoop

First-time organisation create fails with row-level security violation

Shipped· 2 months ago

Creating the very first organisation for a new account returned new row violates row-level security policy for table "organizations".

Root cause: the INSERT ... RETURNING re-checks the SELECT policy, which required org membership — but the org_members row was inserted after the org. Fixed in 0002_org_self_create.sql by (1) loosening the SELECT policy to also accept owner_id = auth.uid(), and (2) adding an AFTER INSERT trigger that seeds the owner's org_members row atomically.

Comments (0)

No comments yet.

Join the discussion

Sign in to leave a comment on this thread.

HollahoopGet yours