ALTER FUNCTION (UDF)
Alters a user-defined function.
Syntax
ALTER FUNCTION [[db-name.]schema.]function‑name( [arg‑list] ) { OWNER TO new‑owner | RENAME TO new‑name | SET FENCED boolean‑expr | SET SCHEMA new‑schema }
Parameters
[db-name.]schema
|
Specifies a schema, by default myschema.thisDbObject If you specify a database, it must be the current database. |
function‑name
|
The name of the user-defined function to alter, one of the following: |
arg‑list | A comma-delimited list of function arguments. If none, specify an empty list. |
OWNER TO
|
Transfers function ownership to another user. |
RENAME TO
|
Assigns a new name to the function. |
SET FENCED boolean‑expr
|
Specifies whether fenced mode is enabled for this function, by default set to true. Fenced mode is not available for user-defined aggregates or user-defined load. |
SET SCHEMA
|
Moves the function to another schema. |
Privileges
Non-superuser: USAGE on the schema and one of the following:
- Function owner
- ALTER privilege on the function
For certain operations, non-superusers must also have the following schema privileges:
Schema privileges required… | For these operations… |
---|---|
CREATE, USAGE | RENAME TO (rename function) |
CREATE: destination schema |
SET SCHEMA (move function to another schema) |
Examples
Rename function UDF_one
to UDF_two
:
=> ALTER FUNCTION UDF_one (int, int) RENAME TO UDF_two;
Move function UDF_two
to schema macros
:
=> ALTER FUNCTION UDF_two (int, int) SET SCHEMA macros;
Disable fenced mode for function UDF_two
:
=> ALTER FUNCTION UDF_two (int, int) SET FENCED false;