DROP FUNCTION

Drops an SQL function or user‑defined functions (UDFs) from the Vertica catalog.

Syntax

DROP FUNCTION [ IF EXISTS ] [[database.]schema.]function[,…] ( [ arg‑list ] )

Parameters

IF EXISTS

Specifies not to report an error if the function to drop does not exist. Use this clause in SQL scripts to avoid errors on dropping non-existent objects before attempting to create them.

[database.]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

The SQL or user-defined function (UDF) to drop, where UDFs can be one of the following types:

You drop aggregate and transformation functions with DROP AGGREGATE FUNCTION and DROP TRANSFORM FUNCTION, respectively.

arg‑list

A comma-delimited list of arguments as defined for this function when it was created, specified as follows:

[arg‑name] arg‑type[,…]

where arg‑name optionally qualifies arg‑type:

  • arg‑name is typically a column name.
  • arg‑type is the name of an SQL data type supported by Vertica.

Privileges

Non-superuser, one of the following:

Requirements

  • To drop a function, you must specify the argument types because several functions might share the same name with different parameters.
  • Vertica does not check for dependencies when you drop a SQL function, so if other objects reference it (such as views or other SQL functions), Vertica returns an error only when those objects are used.

Example

The following command drops the zerowhennull function in the macros schema:

=>  DROP FUNCTION macros.zerowhennull(x INT);
DROP FUNCTION

See Also