DROP ROUTINE

|      DROP ROUTINE       |                       |            |                  |                          |
|:-----------------------:|-----------------------|------------|------------------|--------------------------|
|[Prev](sql-droprole.html)|[Up](sql-commands.html)|SQL Commands|[Home](index.html)| [Next](sql-droprule.html)|

---

[]()

## DROP ROUTINE

DROP ROUTINE — remove a routine

## Synopsis

```
DROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
    [ CASCADE | RESTRICT ]

```

## Description

`DROP ROUTINE` removes the definition of one or more existing routines. The term “routine” includes aggregate functions, normal functions, and procedures. See under [DROP AGGREGATE](sql-dropaggregate.html), [DROP FUNCTION](sql-dropfunction.html), and [DROP PROCEDURE](sql-dropprocedure.html) for the description of the parameters, more examples, and further details.

## Notes

 The lookup rules used by `DROP ROUTINE` are fundamentally the same as for `DROP PROCEDURE`; in particular, `DROP ROUTINE` shares that command's behavior of considering an argument list that has no *`argmode`* markers to be possibly using the SQL standard's definition that `OUT` arguments are included in the list. (`DROP AGGREGATE` and `DROP FUNCTION` do not do that.)

 In some cases where the same name is shared by routines of different kinds, it is possible for `DROP ROUTINE` to fail with an ambiguity error when a more specific command (`DROP FUNCTION`, etc.) would work. Specifying the argument type list more carefully will also resolve such problems.

 These lookup rules are also used by other commands that act on existing routines, such as `ALTER ROUTINE` and `COMMENT ON ROUTINE`.

## Examples

 To drop the routine `foo` for type `integer`:

```
DROP ROUTINE foo(integer);

```

 This command will work independent of whether `foo` is an aggregate, function, or procedure.

## Compatibility

 This command conforms to the SQL standard, with these PostgreSQL extensions:

* The standard only allows one routine to be dropped per command.

* The `IF EXISTS` option is an extension.

* The ability to specify argument modes and names is an extension, and the lookup rules differ when modes are given.

* User-definable aggregate functions are an extension.

## See Also

[DROP AGGREGATE](sql-dropaggregate.html), [DROP FUNCTION](sql-dropfunction.html), [DROP PROCEDURE](sql-dropprocedure.html), [ALTER ROUTINE](sql-alterroutine.html)

 Note that there is no `CREATE ROUTINE` command.

---

|[Prev](sql-droprole.html)|[Up](sql-commands.html)| [Next](sql-droprule.html)|
|:------------------------|:---------------------:|-------------------------:|
|        DROP ROLE        |  [Home](index.html)   |         DROP RULE        |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>