Deprecated RLS features
Last edited: 1/21/2025
The auth.role()
function is now deprecated
The auth.role()
function has been deprecated in favour of using the TO
field, natively supported within Postgres:
_13-- DEPRECATED_13create policy "Public profiles are viewable by everyone."_13on profiles for select using (_13 auth.role() = 'authenticated' or auth.role() = 'anon'_13);_13_13-- RECOMMENDED_13create policy "Public profiles are viewable by everyone."_13on profiles for select_13to authenticated, anon_13using (_13 true_13);
The auth.email()
function is now deprecated
The auth.email()
function has been deprecated in favour a more generic function to return the full JWT:
_11- DEPRECATED_11create policy "User can view their profile."_11on profiles for select using (_11 auth.email() = email_11);_11_11-- RECOMMENDED_11create policy "User can view their profile."_11on profiles for select using (_11 (auth.jwt() ->> 'email') = email_11);