DROP_PROCEDURE(7pg13)
π DROP PROCEDURE β bestie, we're deleting a procedure
okay so real talk β this is the DROP PROCEDURE page from the PostgreSQL 13.23 Documentation, and we're about to learn how to yeet a stored procedure into the void. no cap, it's easier than it sounds π¦
β¨ SYNOPSIS β¨
DROP PROCEDURE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
[ CASCADE | RESTRICT ]
look at her. iconic. one command, so many brackets π
πΈ DESCRIPTION πΈ
DROP PROCEDURE removes the definition of an existing procedure. that's the whole vibe β girl is gone.
But (and this is the part where you gotta pay attention, bestie π«Ά) to run this command the user must be the owner of the procedure. not your friend, not your coworker β you. owner energy only π
also you must specify the argument types to the procedure, because β plot twist β several different procedures can totally exist with the same name and different argument lists. so the arg types are how Postgres tells them apart. it's giving "which twin are you" energy π
π PARAMETERS π
IF EXISTSβ don't throw an error if the procedure doesn't exist. instead, a notice is issued in this case. so like, if it's not there, Postgres just goes "ok noted" instead of yelling at you πnameβ the name (optionally schema-qualified) of an existing procedure. if no argument list is specified, the name must be unique in its schema. lowkey important detail, don't skip it β¨argmodeβ the mode of an argument:INorVARIADIC. if omitted, the default isIN. that's it, that's the whole menu πargnameβ the name of an argument. but note thatDROP PROCEDUREdoes not actually pay any attention to argument names, since only the argument data types are needed to determine the procedure's identity. so likeβ¦ you can write it, she just won't read it πargtypeβ the data type(s) of the procedure's arguments (optionally schema-qualified), if any. this is the one that actually matters, the main character of the parameter list βCASCADEβ automatically drop objects that depend on the procedure, and in turn all objects that depend on those objects (see Section 5.14). it's giving domino effect, it's giving chain reaction π₯RESTRICTβ refuse to drop the procedure if any objects depend on it. this is the default. yes, the safe one is the default, we love a cautious queen π
ok warning time π β CASCADE is not playing around. it will take out everything that depends on your procedure, and everything that depends on that. make sure you mean it before you type it, fr fr.
π§ EXAMPLES π§
DROP PROCEDURE do_db_maintenance();
that's it. that's the example. she's simple, she's clean, she ate π
π₯ COMPATIBILITY π₯
this command conforms to the SQL standard β slay β with these PostgreSQL extensions:
- The standard only allows one procedure to be dropped per command. (we do more. we're built different π)
- The
IF EXISTSoption - The ability to specify argument modes and names
π¦ SEE ALSO π¦
CREATE PROCEDURE(CREATE_PROCEDURE(7)) β the reverse, for when you change your mind πALTER PROCEDURE(ALTER_PROCEDURE(7)) β glow-up, not deletionDROP FUNCTION(DROP_FUNCTION(7)) β same energy, different objectDROP ROUTINE(DROP_ROUTINE(7)) β the generalist
and that's the whole page, bestie π«Ά go forth and drop responsibly. this was written up for PostgreSQL 13.23, dated 2025, and yes β that's the same DROP PROCEDURE(7) girl you came in with. periodt π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-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