Question about schema isolation #3188
-
Hello all! I'm new to postgrest and also trying to learn more about sql beyond the basic crud operations. There is a section in the docs here about schema isolation that I am really interested in learning more about, but there is not much information in there at the moment. Per the docs:
Conceptually, this makes perfect sense, but what is the best way to go about implementing this in practice? Views are a new concept to me. The following seemed to work fine for me: I created two schemas create schema core;
create schema api; Then created a simple table create table core.users (id serial primary key, email text); Then created this view create view api.users as select * from core.users; Finally, created a role create role web_anon nologin;
grant usage on schema api to web_anon;
grant select on api.users to web_anon; I was able to call the Any further guidance or resources would be much appreciated, thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
A random collection of tips:
|
Beta Was this translation helpful? Give feedback.
A random collection of tips:
security_invoker
option for your views. Otherwise it will be really annoying to implement Row Level Security at some point. I use the following pgtap test to make sure we never miss any of the views: