SECURITY DEFINER - privileges of the function's creator, or owner? SECURITY DEFINER - privileges of the function's creator, or owner? postgresql postgresql

SECURITY DEFINER - privileges of the function's creator, or owner?


Usually (initially) the creator is the owner. However, if the owner of the function has been changed, security definer applies to the new owner. Per 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.