From e8ac187c68fdfcda800132d6c3c2e6d45aaf563f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 18 May 2002 13:48:01 +0000 Subject: Allow functions to be executed with the privileges of the function owner. I took the opportunity to remove the pg_proc.proistrusted field. --- doc/src/sgml/func.sgml | 18 +++++++++--------- doc/src/sgml/ref/create_function.sgml | 26 ++++++++++++++++++++++++-- doc/src/sgml/release.sgml | 3 ++- 3 files changed, 35 insertions(+), 12 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 62c36063821..978441347a4 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ @@ -4260,14 +4260,14 @@ SELECT NULLIF(value, '(none)') ... - The session_user is the user that initiated a database - connection; it is fixed for the duration of that connection. The - current_user is the user identifier that is applicable - for permission checking. Currently it is always equal to the session - user, but in the future there might be setuid functions and - other facilities to allow the current user to change temporarily. - In Unix parlance, the session user is the real user - and the current user is the effective user. + The session_user is the user that initiated a + database connection; it is fixed for the duration of that + connection. The current_user is the user identifier + that is applicable for permission checking. Normally, it is equal + to the session user, but it changes during the execution of + functions with the attribute SECURITY DEFINER. + In Unix parlance, the session user is the real user and + the current user is the effective user. diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index 495a1331464..b2d2314a733 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -1,5 +1,5 @@ @@ -21,6 +21,7 @@ CREATE [ OR REPLACE ] FUNCTION name | IMMUTABLE | STABLE | VOLATILE | CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT | IMPLICIT CAST + | [EXTERNAL] SECURITY INVOKER | [EXTERNAL] SECURITY DEFINER | AS 'definition' | AS 'obj_file', 'link_symbol' } ... @@ -199,6 +200,27 @@ CREATE [ OR REPLACE ] FUNCTION name + + EXTERNAL SECURITY INVOKER + EXTERNAL SECURITY DEFINER + + + + SECURITY INVOKER indicates that the 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 created it. + + + + The key word EXTERNAL is present for SQL + compatibility but is optional since, unlike in SQL, this feature + does not only apply to external functions. + + + + definition @@ -372,7 +394,7 @@ CREATE [ OR REPLACE ] FUNCTION name - + Type Cast Functions diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index 9b75049938a..b25b7ef5e38 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ @@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without worries about funny characters. -->