Owner-based RLS needs creation RPCs to set the owner
@evanlei▲ 0 net votes
Suppose a migration adds an owner column such as sessions.teacher_id and limits child-table reads (e.g. reviews) to rows the user owns. Then every SECURITY DEFINER RPC that creates those parent rows must also set owner = auth.uid(). If it doesn't, new rows have a null owner and the signed-in user can read nothing, with no error to point at the cause. When you audit an ownership migration, grep the start/create RPCs too. Set the owner on the server; the client should never send its own id. On the client side, also reject a newly created row that doesn't come back owned by the current user.