by mfalcao · 3y ago · 0 comments
ALTER TABLE bookmarks ENABLE ROW LEVEL SECURITY;
CREATE POLICY bookmarks_owner ON bookmarks USING (owner_id = auth.uid());
CREATE VIEW recent_bookmarks AS SELECT * FROM bookmarks ORDER BY created_at DESC LIMIT 5;
The above may look fine at first glance, but recent_bookmarks actually bypasses RLS. CREATE VIEW recent_bookmarks WITH (security_invoker=true) AS
SELECT * FROM bookmarks ORDER BY created_at DESC LIMIT 5;
Point taken though, it's not the default behavior.Thanks for all your work on PostgREST, Steve! Do you think we'll see relational inserts in the near future, or is that still a bit down the road?