]> begriffs open source - ai-pg/blob - full-docs/txt/sql-dropfunction.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-dropfunction.txt
1
2 DROP FUNCTION
3
4    DROP FUNCTION — remove a function
5
6 Synopsis
7
8 DROP FUNCTION [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ]
9  ) ] [, ...]
10     [ CASCADE | RESTRICT ]
11
12 Description
13
14    DROP FUNCTION removes the definition of an existing function. To
15    execute this command the user must be the owner of the function. The
16    argument types to the function must be specified, since several
17    different functions can exist with the same name and different argument
18    lists.
19
20 Parameters
21
22    IF EXISTS
23           Do not throw an error if the function does not exist. A notice
24           is issued in this case.
25
26    name
27           The name (optionally schema-qualified) of an existing function.
28           If no argument list is specified, the name must be unique in its
29           schema.
30
31    argmode
32           The mode of an argument: IN, OUT, INOUT, or VARIADIC. If
33           omitted, the default is IN. Note that DROP FUNCTION does not
34           actually pay any attention to OUT arguments, since only the
35           input arguments are needed to determine the function's identity.
36           So it is sufficient to list the IN, INOUT, and VARIADIC
37           arguments.
38
39    argname
40           The name of an argument. Note that DROP FUNCTION does not
41           actually pay any attention to argument names, since only the
42           argument data types are needed to determine the function's
43           identity.
44
45    argtype
46           The data type(s) of the function's arguments (optionally
47           schema-qualified), if any.
48
49    CASCADE
50           Automatically drop objects that depend on the function (such as
51           operators or triggers), and in turn all objects that depend on
52           those objects (see Section 5.15).
53
54    RESTRICT
55           Refuse to drop the function if any objects depend on it. This is
56           the default.
57
58 Examples
59
60    This command removes the square root function:
61 DROP FUNCTION sqrt(integer);
62
63    Drop multiple functions in one command:
64 DROP FUNCTION sqrt(integer), sqrt(bigint);
65
66    If the function name is unique in its schema, it can be referred to
67    without an argument list:
68 DROP FUNCTION update_employee_salaries;
69
70    Note that this is different from
71 DROP FUNCTION update_employee_salaries();
72
73    which refers to a function with zero arguments, whereas the first
74    variant can refer to a function with any number of arguments, including
75    zero, as long as the name is unique.
76
77 Compatibility
78
79    This command conforms to the SQL standard, with these PostgreSQL
80    extensions:
81      * The standard only allows one function to be dropped per command.
82      * The IF EXISTS option
83      * The ability to specify argument modes and names
84
85 See Also
86
87    CREATE FUNCTION, ALTER FUNCTION, DROP PROCEDURE, DROP ROUTINE