{
    "content": [
        {
            "type": "text",
            "text": "# ALTER_PROCEDURE (man)\n\n## NAME\n\nALTERPROCEDURE - change the definition of a procedure\n\n## SYNOPSIS\n\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\naction [ ... ] [ RESTRICT ]\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nRENAME TO newname\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nOWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nSET SCHEMA newschema\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\n[ NO ] DEPENDS ON EXTENSION extensionname\nwhere action is one of:\n[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\nSET configurationparameter { TO | = } { value | DEFAULT }\nSET configurationparameter FROM CURRENT\nRESET configurationparameter\nRESET ALL\n\n## DESCRIPTION\n\nALTER PROCEDURE changes the definition of a procedure.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **PARAMETERS**\n- **EXAMPLES**\n- **COMPATIBILITY**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "ALTER_PROCEDURE",
        "section": "",
        "mode": "man",
        "summary": "ALTERPROCEDURE - change the definition of a procedure",
        "synopsis": "ALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\naction [ ... ] [ RESTRICT ]\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nRENAME TO newname\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nOWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nSET SCHEMA newschema\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\n[ NO ] DEPENDS ON EXTENSION extensionname\nwhere action is one of:\n[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\nSET configurationparameter { TO | = } { value | DEFAULT }\nSET configurationparameter FROM CURRENT\nRESET configurationparameter\nRESET ALL",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "To rename the procedure insertdata with two arguments of type integer to insertrecord:",
            "ALTER PROCEDURE insertdata(integer, integer) RENAME TO insertrecord;",
            "To change the owner of the procedure insertdata with two arguments of type integer to joe:",
            "ALTER PROCEDURE insertdata(integer, integer) OWNER TO joe;",
            "To change the schema of the procedure insertdata with two arguments of type integer to",
            "accounting:",
            "ALTER PROCEDURE insertdata(integer, integer) SET SCHEMA accounting;",
            "To mark the procedure insertdata(integer, integer) as being dependent on the extension",
            "myext:",
            "ALTER PROCEDURE insertdata(integer, integer) DEPENDS ON EXTENSION myext;",
            "To adjust the search path that is automatically set for a procedure:",
            "ALTER PROCEDURE checkpassword(text) SET searchpath = admin, pgtemp;",
            "To disable automatic setting of searchpath for a procedure:",
            "ALTER PROCEDURE checkpassword(text) RESET searchpath;",
            "The procedure will now execute with whatever search path is used by its caller."
        ],
        "see_also": [
            {
                "name": "CREATEPROCEDURE",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/CREATEPROCEDURE/7/json"
            },
            {
                "name": "DROPPROCEDURE",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/DROPPROCEDURE/7/json"
            },
            {
                "name": "ALTERFUNCTION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/ALTERFUNCTION/7/json"
            },
            {
                "name": "ALTERROUTINE",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/ALTERROUTINE/7/json"
            },
            {
                "name": "PROCEDURE",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/PROCEDURE/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 54,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "COMPATIBILITY",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "ALTERPROCEDURE - change the definition of a procedure\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "ALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\naction [ ... ] [ RESTRICT ]\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nRENAME TO newname\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nOWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\nSET SCHEMA newschema\nALTER PROCEDURE name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ]\n[ NO ] DEPENDS ON EXTENSION extensionname\n\nwhere action is one of:\n\n[ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER\nSET configurationparameter { TO | = } { value | DEFAULT }\nSET configurationparameter FROM CURRENT\nRESET configurationparameter\nRESET ALL\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "ALTER PROCEDURE changes the definition of a procedure.\n\nYou must own the procedure to use ALTER PROCEDURE. To change a procedure's schema, you must\nalso have CREATE privilege on the new schema. To alter the owner, you must also be a direct\nor indirect member of the new owning role, and that role must have CREATE privilege on the\nprocedure's schema. (These restrictions enforce that altering the owner doesn't do anything\nyou couldn't do by dropping and recreating the procedure. However, a superuser can alter\nownership of any procedure anyway.)\n",
                "subsections": []
            },
            "PARAMETERS": {
                "content": "name\nThe name (optionally schema-qualified) of an existing procedure. If no argument list is\nspecified, the name must be unique in its schema.\n\nargmode\nThe mode of an argument: IN, OUT, INOUT, or VARIADIC. If omitted, the default is IN.\n\nargname\nThe name of an argument. Note that ALTER PROCEDURE does not actually pay any attention to\nargument names, since only the argument data types are used to determine the procedure's\nidentity.\n\nargtype\nThe data type(s) of the procedure's arguments (optionally schema-qualified), if any. See\nDROP PROCEDURE (DROPPROCEDURE(7)) for the details of how the procedure is looked up\nusing the argument data type(s).\n\nnewname\nThe new name of the procedure.\n\nnewowner\nThe new owner of the procedure. Note that if the procedure is marked SECURITY DEFINER, it\nwill subsequently execute as the new owner.\n\nnewschema\nThe new schema for the procedure.\n\nextensionname\nThis form marks the procedure as dependent on the extension, or no longer dependent on\nthe extension if NO is specified. A procedure that's marked as dependent on an extension\nis dropped when the extension is dropped, even if cascade is not specified. A procedure\ncan depend upon multiple extensions, and will be dropped when any one of those extensions\nis dropped.\n\n[ EXTERNAL ] SECURITY INVOKER\n[ EXTERNAL ] SECURITY DEFINER\nChange whether the procedure is a security definer or not. The key word EXTERNAL is\nignored for SQL conformance. See CREATE PROCEDURE (CREATEPROCEDURE(7)) for more\ninformation about this capability.\n\nconfigurationparameter\nvalue\nAdd or change the assignment to be made to a configuration parameter when the procedure\nis called. If value is DEFAULT or, equivalently, RESET is used, the procedure-local\nsetting is removed, so that the procedure executes with the value present in its\nenvironment. Use RESET ALL to clear all procedure-local settings.  SET FROM CURRENT saves\nthe value of the parameter that is current when ALTER PROCEDURE is executed as the value\nto be applied when the procedure is entered.\n\nSee SET(7) and Chapter 20 for more information about allowed parameter names and values.\n\nRESTRICT\nIgnored for conformance with the SQL standard.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "To rename the procedure insertdata with two arguments of type integer to insertrecord:\n\nALTER PROCEDURE insertdata(integer, integer) RENAME TO insertrecord;\n\nTo change the owner of the procedure insertdata with two arguments of type integer to joe:\n\nALTER PROCEDURE insertdata(integer, integer) OWNER TO joe;\n\nTo change the schema of the procedure insertdata with two arguments of type integer to\naccounting:\n\nALTER PROCEDURE insertdata(integer, integer) SET SCHEMA accounting;\n\nTo mark the procedure insertdata(integer, integer) as being dependent on the extension\nmyext:\n\nALTER PROCEDURE insertdata(integer, integer) DEPENDS ON EXTENSION myext;\n\nTo adjust the search path that is automatically set for a procedure:\n\nALTER PROCEDURE checkpassword(text) SET searchpath = admin, pgtemp;\n\nTo disable automatic setting of searchpath for a procedure:\n\nALTER PROCEDURE checkpassword(text) RESET searchpath;\n\nThe procedure will now execute with whatever search path is used by its caller.\n",
                "subsections": []
            },
            "COMPATIBILITY": {
                "content": "This statement is partially compatible with the ALTER PROCEDURE statement in the SQL\nstandard. The standard allows more properties of a procedure to be modified, but does not\nprovide the ability to rename a procedure, make a procedure a security definer, attach\nconfiguration parameter values to a procedure, or change the owner, schema, or volatility of\na procedure. The standard also requires the RESTRICT key word, which is optional in\nPostgreSQL.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "CREATE PROCEDURE (CREATEPROCEDURE(7)), DROP PROCEDURE (DROPPROCEDURE(7)), ALTER FUNCTION\n(ALTERFUNCTION(7)), ALTER ROUTINE (ALTERROUTINE(7))\n\n\n\nPostgreSQL 14.23                                2026                              ALTER PROCEDURE(7)",
                "subsections": []
            }
        }
    }
}