Reputation: 87177
How do I delete a stored procedure in Postgresql?
Upvotes: 20
Views: 18736
Reputation: 702
I was able to drop a Stored Procedure by below command:
DROP PROCEDURE IF EXISTS <schema-name>.<procedure-name>(all-arguments);
Example:
DROP PROCEDURE IF EXISTS public.my_procedure(empname character varying);
Upvotes: 7
Reputation: 175586
PostgreSQL 11 introduced stored procedures. Plus it adds new syntax DROP ROUTINE:
DROP ROUTINE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...]
DROP ROUTINE removes the definition of an existing routine, which can be an aggregate function, a normal function, or a procedure.
DROP ROUTINE IF EXISTS foo(integer);
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
The ability to specify argument modes and names
Aggregate functions are an extension.
Upvotes: 2
Reputation: 2129
you can delete it even without arguments name
DROP FUNCTION IF EXISTS name;
Upvotes: 3