Do I understand correctly that the Postgres views ...
# help
l
Do I understand correctly that the Postgres views are the answer to CLS (column level security)? That implies that I need to create a lot of views for every table if I need to restrict read access to columns in the row based on the role (user itself, team administrator, global administrator, anonymous...)
s
No this is not the answer, this is one workaround. Column Level Security shouldn't be necessary if your database is modelled correctly. The right solution is to model your data correctly.
l
Ok, then how would I ideally model the following situation (I'm new to Supabase and coming from Laravel/backend ecosystem): Table profiles with realname, username, varified_at columns. - User can read all and write realname and username - Admin can read all and write all - Anonymous can read username and varified_at and write nothing The only way I can think of it is to have multiple tables representing individual entity information like public_profiles and private_profiles
I have gone thru the new Egghead course and it is what I thought. You need to create one table per cluster of data associated with one entity and manage their consistency with triggers to be compliant with the way of doing things. So for my example: - table: profiles - profile_id (or user_id) - realname -table: public_profiles - profile_id (or user_id) - username - varified_at
s