SECURITY DEFINER - 函数创建者或所有者的特权?
SECURITY DEFINER - privileges of the function's creator, or owner?
Postgres 的 official docs 表示使用 SECURITY DEFINER 运行 定义的函数具有 创建 它的用户的权限。
但是其他来源,例如 here and here,声称它是该函数的 所有者 的特权。
哪个是正确的?
(适用于 9.4+)
通常(最初)创建者是所有者。但是,如果函数的所有者已更改,则 security definer
适用于新所有者。每 the documentation:
new_owner - The new owner of the function. Note that if the function is marked SECURITY DEFINER, it will subsequently execute as the new owner.
Postgres 的 official docs 表示使用 SECURITY DEFINER 运行 定义的函数具有 创建 它的用户的权限。
但是其他来源,例如 here and here,声称它是该函数的 所有者 的特权。
哪个是正确的?
(适用于 9.4+)
通常(最初)创建者是所有者。但是,如果函数的所有者已更改,则 security definer
适用于新所有者。每 the documentation:
new_owner - The new owner of the function. Note that if the function is marked SECURITY DEFINER, it will subsequently execute as the new owner.