DROP_FUNCTION(7pg14)
π DROP_FUNCTION π
okay so bestie, the manual name is DROP_FUNCTION and we're looking at the PostgreSQL 14.24 docs β let's get into it β¨
π NAME π
DROP_FUNCTION β remove a function, periodt. like literally just yeet that function out of existence π
β¨ SYNOPSIS β¨
DROP FUNCTION [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
[ CASCADE | RESTRICT ]
π DESCRIPTION π
okay so DROP FUNCTION removes the definition of an existing function. that's it, that's the vibe π¦
but listen β to execute this command, the user must be the owner of the function. no cap, you can't just drop someone else's stuff π
also the argument types to the function must be specified, since several different functions can exist with the same name and different argument lists. like yes bestie there can be multiple functions with the same name, it's giving main character energy for each overload β¨
πΈ PARAMETERS πΈ
IF EXISTSβ do not throw an error if the function does not exist. a notice is issued in this case. so it's like, chill, no drama if it's already gone πnameβ the name (optionally schema-qualified) of an existing function. if no argument list is specified, the name must be unique in its schema. iykyk πargmodeβ the mode of an argument:IN,OUT,INOUT, orVARIADIC. if omitted, the default isIN. note thatDROP FUNCTIONdoes not actually pay any attention toOUTarguments, since only the input arguments are needed to determine the function's identity. so it is sufficient to list theIN,INOUT, andVARIADICarguments. basicallyOUTarguments are like, not invited to this party πargnameβ the name of an argument. note thatDROP FUNCTIONdoes not actually pay any attention to argument names, since only the argument data types are needed to determine the function's identity. so yeah, names don't matter here, it's what's inside that counts πargtypeβ the data type(s) of the function's arguments (optionally schema-qualified), if any. this is the actual tea βCASCADEβ automatically drop objects that depend on the function (such as operators or triggers), and in turn all objects that depend on those objects (see Section 5.14). it's giving domino effect, everything falls π₯RESTRICTβ refuse to drop the function if any objects depend on it. this is the default. so it's like, protective mode activated, won't let you break stuff by accident π«Ά
π¦ EXAMPLES π¦
this command removes the square root function:
DROP FUNCTION sqrt(integer);
drop multiple functions in one command, because why not slay multiple at once:
DROP FUNCTION sqrt(integer), sqrt(bigint);
if the function name is unique in its schema, it can be referred to without an argument list:
DROP FUNCTION update_employee_salaries;
note that this is different from
DROP FUNCTION update_employee_salaries();
which refers to a function with zero arguments, whereas the first variant can refer to a function with any number of arguments, including zero, as long as the name is unique. okay so the parentheses matter bestie, don't forget them or you're talking about a different function entirely π
π COMPATIBILITY π
this command conforms to the SQL standard, with these PostgreSQL extensions:
- the standard only allows one function to be dropped per command. postgres said "we can do better" π
- the
IF EXISTSoption - the ability to specify argument modes and names
β SEE ALSO β
CREATE FUNCTION(CREATE_FUNCTION(7))ALTER FUNCTION(ALTER_FUNCTION(7))DROP PROCEDURE(DROP_PROCEDURE(7))DROP ROUTINE(DROP_ROUTINE(7))
okay that's the whole vibe bestie, go drop those functions responsibly πβ¨ππ¦πΈπ
this has been the PostgreSQL 14.24 documentation, dated 2026 β catch you on the flip side, mwah π«Άπ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms