Skip to content

Do I need to expose "security definer" Functions in Row Level Security Policies?

PostgREST 支持 2 个配置参数:

🌐 PostgREST supports 2 config parameters:

  • 公开的模式
  • 额外搜索路径

image

如果你在策略中使用它们,你不需要把你的“安全定义者”函数添加到其中任何一个。

🌐 You do not need to add your "security definer" Functions to either of these if you are using them in your Policies.

只要你在 RLS 里明确使用该 schema(例如:security.rls_func),PostgREST 不需要知道这个函数在额外的搜索路径或暴露的 schemas 上。

🌐 PostgREST doesn’t need to know about this function on extra search path or exposed schemas, as long as you explicitly use the schema inside RLS (e.g.: security.rls_func).