logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

DROP_ROUTINE - remove a routine

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.

Description

DROPROUTINE removes the definition of one or more existing routines. The term “routine” includes
       aggregate functions, normal functions, and procedures. See under DROP AGGREGATE (DROP_AGGREGATE(7)), DROP
       FUNCTION (DROP_FUNCTION(7)), and DROP PROCEDURE (DROP_PROCEDURE(7)) for the description of the
       parameters, more examples, and further details.

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.

Name

       DROP_ROUTINE - remove a routine

Notes

       The lookup rules used by DROPROUTINE are fundamentally the same as for DROPPROCEDURE; in particular,
       DROPROUTINE 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. (DROPAGGREGATE and DROPFUNCTION do not do that.)

       In some cases where the same name is shared by routines of different kinds, it is possible for DROPROUTINE to fail with an ambiguity error when a more specific command (DROPFUNCTION, 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 ALTERROUTINE
       and COMMENTONROUTINE.

See Also

       DROP AGGREGATE (DROP_AGGREGATE(7)), DROP FUNCTION (DROP_FUNCTION(7)), DROP PROCEDURE (DROP_PROCEDURE(7)),
       ALTER ROUTINE (ALTER_ROUTINE(7))

       Note that there is no CREATE ROUTINE command.

PostgreSQL 17.5                                       2025                                       DROPROUTINE(7)

Synopsis

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

See Also