A newer version of this documentation is available.

View Latest


  • concept
  • Developer Preview
    The DROP FUNCTION statement enables you to delete a user-defined function.

    This is a Developer Preview feature, intended for development purposes only. Do not use this feature in production. No Enterprise Support is provided for Developer Preview features.

    Refer to Developer Preview Mode for more information.


    drop-function ::= DROP FUNCTION name
    'DROP' 'FUNCTION' name

    The name of the function. This may be an unqualified identifier, such as func1 or `func-1`, or a qualified identifier with a namespace, such as default:func1.

    The name of a user-defined function is case-sensitive, unlike that of a built-in function. You must delete the user-defined function using the same case that was used when it was created.


    When you drop an external user-defined function, the JavaScript library and function on which the user-defined function depended are not deleted. This enables you to create a new user-defined function with a different name, or a different number of parameters, using the same JavaScript library and function.

    To change or delete the JavaScript library and the JavaScript function, you must use the N1QL Functions REST API. For details, refer to Functions REST API.


    Example 1. Drop an inline function

    This statement deletes an inline function called celsius.

    DROP FUNCTION celsius;

    You can run the following query to check that the function is no longer available.

    SELECT * FROM system:functions;
    Example 2. Drop an external function

    This statement deletes an external function called javaScriptAdd, which depends on a JavaScript function called add in a library called math.

    DROP FUNCTION javaScriptAdd;

    You can run the following command to check that the JavaScript add function and math library are still available.

    $ curl -v -X GET http://localhost:8093/functions/v1/libraries -H 'content-type: application/json' -u Administrator:password