DROP_ROUTINE(7)
๐ DROP ROUTINE ๐
okay bestie, you know how we're doing this โ this is the DROP ROUTINE page from the PostgreSQL 18.6 docs, and I'm gonna make it make sense. periodt.
โจ NAME โจ
DROP_ROUTINE โ bestie, it removes a routine. that's the whole job. she's a deleter. ๐
๐ธ SYNOPSIS ๐ธ
DROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
[ CASCADE | RESTRICT ]
look at her. so much bracket nesting. so much power. ๐
๐ฆ DESCRIPTION ๐ฆ
DROP ROUTINE removes the definition of one or more existing routines. yes, plural, you can take out multiple at once, she's efficient like that.
now โ the term "routine" here is a big umbrella word. it covers aggregate functions, normal functions, and procedures. all of them. one word. iconic.
if you wanna know what all the parameters actually do, plus more examples and further details, go peek at DROP AGGREGATE (DROP_AGGREGATE(7)), DROP FUNCTION (DROP_FUNCTION(7)), and DROP PROCEDURE (DROP_PROCEDURE(7)). they're the deep dives, this one's the vibes. ๐
๐ NOTES ๐
okay this part is important so sit up bestie ๐ซถ
the lookup rules that DROP ROUTINE uses are fundamentally the same as the ones DROP PROCEDURE uses. and specifically โ DROP ROUTINE shares that command's behavior of treating an argument list with no argmode markers as possibly using the SQL standard's definition, where OUT arguments are included in the list. (heads up: DROP AGGREGATE and DROP FUNCTION do not do that. different rules. do not mix them up. ๐)
and sometimes, when the same name is shared by routines of different kinds, DROP ROUTINE can straight up fail with an ambiguity error โ even when a more specific command like DROP FUNCTION or whatever would've worked fine. so annoying. the fix? specify the argument type list more carefully. that resolves it. โจ
oh and btw โ these same lookup rules are also used by other commands that act on existing routines, like ALTER ROUTINE and COMMENT ON ROUTINE. so it's not just a DROP ROUTINE thing, it's a whole ecosystem. iykyk. ๐
๐ EXAMPLES ๐
wanna drop the routine foo for type integer? say less:
DROP ROUTINE foo(integer);
and here's the slay part โ this command works independent of whether foo is an aggregate, a function, or a procedure. you don't gotta know. she knows. ๐
๐ COMPATIBILITY ๐
this command conforms to the SQL standard, with these PostgreSQL extensions:
- the standard only allows one routine to be dropped per command. we allow more. we're generous.
- the
IF EXISTSoption is an extension. - the ability to specify argument modes and names is an extension โ and the lookup rules differ when modes are given. (yes really. different rules.)
- user-definable aggregate functions are an extension.
๐ SEE ALSO ๐
DROP AGGREGATE(DROP_AGGREGATE(7))DROP FUNCTION(DROP_FUNCTION(7))DROP PROCEDURE(DROP_PROCEDURE(7))ALTER ROUTINE(ALTER_ROUTINE(7))
and one last lil thing, bestie, don't go looking for it โ there is no CREATE ROUTINE command. she drops, she does not create. balance. ๐
mwah that's the whole page, you ate it, and this was brought to you by PostgreSQL 18.6, dated 2026, filed under DROP ROUTINE(7). go drop something (responsibly). ๐๐โจ
๐ฆ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 ยท PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 ยท PostgreSQL
- arch rolling: postgresql 18.6-4 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 ยท PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 ยท PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms