From c06965544188244efa703f6a97f3088a291d57b5 Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Mon, 14 Mar 2005 00:19:37 +0000 Subject: Allow ALTER FUNCTION to change a function's strictness, volatility, and whether or not it is a security definer. Changing a function's strictness is required by SQL2003, and the other capabilities make sense. Also, allow an optional RESTRICT noise word to be specified, for SQL conformance. Some trivial regression tests added and the documentation has been updated. --- doc/src/sgml/ref/alter_function.sgml | 83 ++++++++++++++++++++++++++++++++---- doc/src/sgml/ref/alter_index.sgml | 8 ++-- 2 files changed, 77 insertions(+), 14 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/alter_function.sgml b/doc/src/sgml/ref/alter_function.sgml index 00dfcac007a..468aa2b2e2e 100644 --- a/doc/src/sgml/ref/alter_function.sgml +++ b/doc/src/sgml/ref/alter_function.sgml @@ -1,5 +1,5 @@ @@ -20,8 +20,15 @@ PostgreSQL documentation +ALTER FUNCTION name ( [ type [, ...] ] ) action [, ... ] [ RESTRICT ] ALTER FUNCTION name ( [ type [, ...] ] ) RENAME TO newname ALTER FUNCTION name ( [ type [, ...] ] ) OWNER TO newowner + +where action is one of: + + CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT + IMMUTABLE | STABLE | VOLATILE + [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER @@ -69,11 +76,65 @@ ALTER FUNCTION name ( [ newowner - The new owner of the function. - To change the owner of a function, you must be a superuser. - Note that if the function is marked - SECURITY DEFINER, - it will subsequently execute as the new owner. + The new owner of the function. To change the owner of a + function, you must be a superuser. Note that if the function is + marked SECURITY DEFINER, it will subsequently + execute as the new owner. + + + + + + CALLED ON NULL INPUT + RETURNS NULL ON NULL INPUT + STRICT + + + + CALLED ON NULL INPUT changes the function so + that it will be invoked when some or all of its arguments are + null. RETURNS NULL ON NULL INPUT or + STRICT changes the function so that it + always returns null if any of its arguments are null. See for more information. + + + + + + IMMUTABLE + STABLE + VOLATILE + + + + Change the volatility of the function to the specified + type. See for more + information about function volatility. + + + + + + EXTERNAL SECURITY INVOKER + EXTERNAL SECURITY DEFINER + + + + Change whether the function is a security definer or not. The + key word EXTERNAL is ignored for SQL + conformance. See for more + information about this capability. + + + + + + RESTRICT + + + + Ignored for conformance with the SQL standard. @@ -104,9 +165,13 @@ ALTER FUNCTION sqrt(integer) OWNER TO joe; Compatibility - There is an ALTER FUNCTION statement in the SQL - standard, but it does not provide the option to rename the - function or change the owner. + This statement is partially compatible with the ALTER + FUNCTION statement in the SQL standard. The standard allows more + properties of a function to be modified, but does not provide the + ability to rename a function, make a function a security definer, + or change the owner or volatility of a function. The standard also + requires the RESTRICT key word; it is optional in + PostgreSQL. diff --git a/doc/src/sgml/ref/alter_index.sgml b/doc/src/sgml/ref/alter_index.sgml index 4ce4a6871cf..7ea1f2e97a5 100644 --- a/doc/src/sgml/ref/alter_index.sgml +++ b/doc/src/sgml/ref/alter_index.sgml @@ -1,5 +1,5 @@ @@ -20,10 +20,8 @@ PostgreSQL documentation -ALTER INDEX name - action [, ... ] -ALTER INDEX name - RENAME TO new_name +ALTER INDEX name action [, ... ] +ALTER INDEX name RENAME TO new_name where action is one of: -- cgit v1.2.3