4 ALTER PROCEDURE — change the definition of a procedure
8 ALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
9 action [ ... ] [ RESTRICT ]
10 ALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
12 ALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
13 OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
14 ALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
16 ALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]
17 [ NO ] DEPENDS ON EXTENSION extension_name
19 where action is one of:
21 [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
22 SET configuration_parameter { TO | = } { value | DEFAULT }
23 SET configuration_parameter FROM CURRENT
24 RESET configuration_parameter
29 ALTER PROCEDURE changes the definition of a procedure.
31 You must own the procedure to use ALTER PROCEDURE. To change a
32 procedure's schema, you must also have CREATE privilege on the new
33 schema. To alter the owner, you must be able to SET ROLE to the new
34 owning role, and that role must have CREATE privilege on the
35 procedure's schema. (These restrictions enforce that altering the owner
36 doesn't do anything you couldn't do by dropping and recreating the
37 procedure. However, a superuser can alter ownership of any procedure
43 The name (optionally schema-qualified) of an existing procedure.
44 If no argument list is specified, the name must be unique in its
48 The mode of an argument: IN, OUT, INOUT, or VARIADIC. If
49 omitted, the default is IN.
52 The name of an argument. Note that ALTER PROCEDURE does not
53 actually pay any attention to argument names, since only the
54 argument data types are used to determine the procedure's
58 The data type(s) of the procedure's arguments (optionally
59 schema-qualified), if any. See DROP PROCEDURE for the details of
60 how the procedure is looked up using the argument data type(s).
63 The new name of the procedure.
66 The new owner of the procedure. Note that if the procedure is
67 marked SECURITY DEFINER, it will subsequently execute as the new
71 The new schema for the procedure.
74 This form marks the procedure as dependent on the extension, or
75 no longer dependent on the extension if NO is specified. A
76 procedure that's marked as dependent on an extension is dropped
77 when the extension is dropped, even if cascade is not specified.
78 A procedure can depend upon multiple extensions, and will be
79 dropped when any one of those extensions is dropped.
81 [ EXTERNAL ] SECURITY INVOKER
82 [ EXTERNAL ] SECURITY DEFINER
83 Change whether the procedure is a security definer or not. The
84 key word EXTERNAL is ignored for SQL conformance. See CREATE
85 PROCEDURE for more information about this capability.
87 configuration_parameter
89 Add or change the assignment to be made to a configuration
90 parameter when the procedure is called. If value is DEFAULT or,
91 equivalently, RESET is used, the procedure-local setting is
92 removed, so that the procedure executes with the value present
93 in its environment. Use RESET ALL to clear all procedure-local
94 settings. SET FROM CURRENT saves the value of the parameter that
95 is current when ALTER PROCEDURE is executed as the value to be
96 applied when the procedure is entered.
98 See SET and Chapter 19 for more information about allowed
99 parameter names and values.
102 Ignored for conformance with the SQL standard.
106 To rename the procedure insert_data with two arguments of type integer
108 ALTER PROCEDURE insert_data(integer, integer) RENAME TO insert_record;
110 To change the owner of the procedure insert_data with two arguments of
112 ALTER PROCEDURE insert_data(integer, integer) OWNER TO joe;
114 To change the schema of the procedure insert_data with two arguments of
115 type integer to accounting:
116 ALTER PROCEDURE insert_data(integer, integer) SET SCHEMA accounting;
118 To mark the procedure insert_data(integer, integer) as being dependent
119 on the extension myext:
120 ALTER PROCEDURE insert_data(integer, integer) DEPENDS ON EXTENSION myext;
122 To adjust the search path that is automatically set for a procedure:
123 ALTER PROCEDURE check_password(text) SET search_path = admin, pg_temp;
125 To disable automatic setting of search_path for a procedure:
126 ALTER PROCEDURE check_password(text) RESET search_path;
128 The procedure will now execute with whatever search path is used by its
133 This statement is partially compatible with the ALTER PROCEDURE
134 statement in the SQL standard. The standard allows more properties of a
135 procedure to be modified, but does not provide the ability to rename a
136 procedure, make a procedure a security definer, attach configuration
137 parameter values to a procedure, or change the owner, schema, or
138 volatility of a procedure. The standard also requires the RESTRICT key
139 word, which is optional in PostgreSQL.
143 CREATE PROCEDURE, DROP PROCEDURE, ALTER FUNCTION, ALTER ROUTINE