First-time organisation create fails with row-level security violation
Shipped· by someone· 5 days 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.
Sign in to leave a comment.