diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index 7e6d52c7dcf..863d99d1fc0 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -411,7 +411,9 @@ CREATE [ OR REPLACE ] FUNCTION is to be executed with the privileges of the user that calls it. That is the default. SECURITY DEFINER specifies that the function is to be executed with the - privileges of the user that owns it. + privileges of the user that owns it. For information on how to + write SECURITY DEFINER functions safely, + see below. @@ -776,6 +778,11 @@ SELECT * FROM dup(42); use in securing functions + + createrole_self_grant configuration parameter + use in securing functions + + Because a SECURITY DEFINER function is executed with the privileges of the user that owns it, care is needed to @@ -815,11 +822,10 @@ $$ LANGUAGE plpgsql - Before PostgreSQL version 8.3, the - SET clause was not available, and so older functions may - contain rather complicated logic to save, set, and restore - search_path. The SET clause is far easier - to use for this purpose. + If the security definer function intends to create roles, and if it + is running as a non-superuser, createrole_self_grant + should also be set to a known value using the SET + clause.