ALTER FUNCTION (UDF)

Alters a user-defined function (UDF).

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 public. If schema is any schema other than public, you must supply the schema name. For example:

myschema.thisDbObject

If you specify a database, it must be the current database.

function‑name

The name of the UDF to alter.

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.

Note: Fenced mode is not available for user-defined aggregates or user-defined load.

SET SCHEMA

Moves the function to another schema.

Privileges

Superuser or function owner. For non-superusers, the following requirements also apply:

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;