| --- |
| title: DROP FUNCTION |
| --- |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| Removes a function. |
| |
| ## <a id="topic1__section2"></a>Synopsis |
| |
| ``` pre |
| DROP FUNCTION [IF EXISTS] <name> ( [ [<argmode>] [<argname>] <argtype> |
| [, ...] ] ) [CASCADE | RESTRICT] |
| ``` |
| |
| ## <a id="topic1__section3"></a>Description |
| |
| `DROP FUNCTION` removes the definition of an existing function. To execute this command the user must be the owner of the function. The argument types to the function must be specified, since several different functions may exist with the same name and different argument lists. |
| |
| ## <a id="topic1__section4"></a>Parameters |
| |
| <dt>IF EXISTS </dt> |
| <dd>Do not throw an error if the function does not exist. A notice is issued in this case.</dd> |
| |
| <dt>\<name\> </dt> |
| <dd>The name (optionally schema-qualified) of an existing function.</dd> |
| |
| <dt>\<argmode\> </dt> |
| <dd>The mode of an argument: either `IN`, `OUT`, or `INOUT`. If omitted, the default is IN. Note that `DROP FUNCTION` does not actually pay any attention to `OUT` arguments, since only the input arguments are needed to determine the function's identity. So it is sufficient to list the `IN` and `INOUT` arguments.</dd> |
| |
| <dt>\<argname\> </dt> |
| <dd>The name of an argument. Note that `DROP FUNCTION` does not actually pay any attention to argument names, since only the argument data types are needed to determine the function's identity.</dd> |
| |
| <dt>\<argtype\> </dt> |
| <dd>The data type(s) of the function's arguments (optionally schema-qualified), if any.</dd> |
| |
| <dt>CASCADE </dt> |
| <dd>Automatically drop objects that depend on the function such as operators.</dd> |
| |
| <dt>RESTRICT </dt> |
| <dd>Refuse to drop the function if any objects depend on it. This is the default.</dd> |
| |
| ## <a id="topic1__section5"></a>Examples |
| |
| Drop the square root function: |
| |
| ``` pre |
| DROP FUNCTION sqrt(integer); |
| ``` |
| |
| ## <a id="topic1__section6"></a>Compatibility |
| |
| A `DROP FUNCTION` statement is defined in the SQL standard, but it is not compatible with this command. |
| |
| ## <a id="topic1__section7"></a>See Also |
| |
| [ALTER FUNCTION](ALTER-FUNCTION.html), [CREATE FUNCTION](CREATE-FUNCTION.html) |