{
    "content": [
        {
            "type": "text",
            "text": "# ALTER_EXTENSION (man)\n\n## NAME\n\nALTEREXTENSION - change the definition of an extension\n\n## SYNOPSIS\n\nALTER EXTENSION name UPDATE [ TO newversion ]\nALTER EXTENSION name SET SCHEMA newschema\nALTER EXTENSION name ADD memberobject\nALTER EXTENSION name DROP memberobject\nwhere memberobject is:\nACCESS METHOD objectname |\nAGGREGATE aggregatename ( aggregatesignature ) |\nCAST (sourcetype AS targettype) |\nCOLLATION objectname |\nCONVERSION objectname |\nDOMAIN objectname |\nEVENT TRIGGER objectname |\nFOREIGN DATA WRAPPER objectname |\nFOREIGN TABLE objectname |\nFUNCTION functionname [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nMATERIALIZED VIEW objectname |\nOPERATOR operatorname (lefttype, righttype) |\nOPERATOR CLASS objectname USING indexmethod |\nOPERATOR FAMILY objectname USING indexmethod |\n[ PROCEDURAL ] LANGUAGE objectname |\nPROCEDURE procedurename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nROUTINE routinename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nSCHEMA objectname |\nSEQUENCE objectname |\nSERVER objectname |\nTABLE objectname |\nTEXT SEARCH CONFIGURATION objectname |\nTEXT SEARCH DICTIONARY objectname |\nTEXT SEARCH PARSER objectname |\nTEXT SEARCH TEMPLATE objectname |\nTRANSFORM FOR typename LANGUAGE langname |\nTYPE objectname |\nVIEW objectname\nand aggregatesignature is:\n* |\n[ argmode ] [ argname ] argtype [ , ... ] |\n[ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]\n\n## DESCRIPTION\n\nALTER EXTENSION changes the definition of an installed extension. There are several subforms:\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_EXTENSION",
        "section": "",
        "mode": "man",
        "summary": "ALTEREXTENSION - change the definition of an extension",
        "synopsis": "ALTER EXTENSION name UPDATE [ TO newversion ]\nALTER EXTENSION name SET SCHEMA newschema\nALTER EXTENSION name ADD memberobject\nALTER EXTENSION name DROP memberobject\nwhere memberobject is:\nACCESS METHOD objectname |\nAGGREGATE aggregatename ( aggregatesignature ) |\nCAST (sourcetype AS targettype) |\nCOLLATION objectname |\nCONVERSION objectname |\nDOMAIN objectname |\nEVENT TRIGGER objectname |\nFOREIGN DATA WRAPPER objectname |\nFOREIGN TABLE objectname |\nFUNCTION functionname [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nMATERIALIZED VIEW objectname |\nOPERATOR operatorname (lefttype, righttype) |\nOPERATOR CLASS objectname USING indexmethod |\nOPERATOR FAMILY objectname USING indexmethod |\n[ PROCEDURAL ] LANGUAGE objectname |\nPROCEDURE procedurename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nROUTINE routinename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nSCHEMA objectname |\nSEQUENCE objectname |\nSERVER objectname |\nTABLE objectname |\nTEXT SEARCH CONFIGURATION objectname |\nTEXT SEARCH DICTIONARY objectname |\nTEXT SEARCH PARSER objectname |\nTEXT SEARCH TEMPLATE objectname |\nTRANSFORM FOR typename LANGUAGE langname |\nTYPE objectname |\nVIEW objectname\nand aggregatesignature is:\n* |\n[ argmode ] [ argname ] argtype [ , ... ] |\n[ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "To update the hstore extension to version 2.0:",
            "ALTER EXTENSION hstore UPDATE TO '2.0';",
            "To change the schema of the hstore extension to utils:",
            "ALTER EXTENSION hstore SET SCHEMA utils;",
            "To add an existing function to the hstore extension:",
            "ALTER EXTENSION hstore ADD FUNCTION populaterecord(anyelement, hstore);"
        ],
        "see_also": [
            {
                "name": "CREATEEXTENSION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/CREATEEXTENSION/7/json"
            },
            {
                "name": "DROPEXTENSION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/DROPEXTENSION/7/json"
            },
            {
                "name": "EXTENSION",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/EXTENSION/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 42,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 24,
                "subsections": []
            },
            {
                "name": "PARAMETERS",
                "lines": 56,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "COMPATIBILITY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "ALTEREXTENSION - change the definition of an extension\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "ALTER EXTENSION name UPDATE [ TO newversion ]\nALTER EXTENSION name SET SCHEMA newschema\nALTER EXTENSION name ADD memberobject\nALTER EXTENSION name DROP memberobject\n\nwhere memberobject is:\n\nACCESS METHOD objectname |\nAGGREGATE aggregatename ( aggregatesignature ) |\nCAST (sourcetype AS targettype) |\nCOLLATION objectname |\nCONVERSION objectname |\nDOMAIN objectname |\nEVENT TRIGGER objectname |\nFOREIGN DATA WRAPPER objectname |\nFOREIGN TABLE objectname |\nFUNCTION functionname [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nMATERIALIZED VIEW objectname |\nOPERATOR operatorname (lefttype, righttype) |\nOPERATOR CLASS objectname USING indexmethod |\nOPERATOR FAMILY objectname USING indexmethod |\n[ PROCEDURAL ] LANGUAGE objectname |\nPROCEDURE procedurename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nROUTINE routinename [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |\nSCHEMA objectname |\nSEQUENCE objectname |\nSERVER objectname |\nTABLE objectname |\nTEXT SEARCH CONFIGURATION objectname |\nTEXT SEARCH DICTIONARY objectname |\nTEXT SEARCH PARSER objectname |\nTEXT SEARCH TEMPLATE objectname |\nTRANSFORM FOR typename LANGUAGE langname |\nTYPE objectname |\nVIEW objectname\n\nand aggregatesignature is:\n\n* |\n[ argmode ] [ argname ] argtype [ , ... ] |\n[ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "ALTER EXTENSION changes the definition of an installed extension. There are several subforms:\n\nUPDATE\nThis form updates the extension to a newer version. The extension must supply a suitable\nupdate script (or series of scripts) that can modify the currently-installed version into\nthe requested version.\n\nSET SCHEMA\nThis form moves the extension's objects into another schema. The extension has to be\nrelocatable for this command to succeed.\n\nADD memberobject\nThis form adds an existing object to the extension. This is mainly useful in extension\nupdate scripts. The object will subsequently be treated as a member of the extension;\nnotably, it can only be dropped by dropping the extension.\n\nDROP memberobject\nThis form removes a member object from the extension. This is mainly useful in extension\nupdate scripts. The object is not dropped, only disassociated from the extension.\nSee Section 38.17 for more information about these operations.\n\nYou must own the extension to use ALTER EXTENSION. The ADD/DROP forms require ownership of\nthe added/dropped object as well.\n",
                "subsections": []
            },
            "PARAMETERS": {
                "content": "name\nThe name of an installed extension.\n\nnewversion\nThe desired new version of the extension. This can be written as either an identifier or\na string literal. If not specified, ALTER EXTENSION UPDATE attempts to update to whatever\nis shown as the default version in the extension's control file.\n\nnewschema\nThe new schema for the extension.\n\nobjectname\naggregatename\nfunctionname\noperatorname\nprocedurename\nroutinename\nThe name of an object to be added to or removed from the extension. Names of tables,\naggregates, domains, foreign tables, functions, operators, operator classes, operator\nfamilies, procedures, routines, sequences, text search objects, types, and views can be\nschema-qualified.\n\nsourcetype\nThe name of the source data type of the cast.\n\ntargettype\nThe name of the target data type of the cast.\n\nargmode\nThe mode of a function, procedure, or aggregate argument: IN, OUT, INOUT, or VARIADIC. If\nomitted, the default is IN. Note that ALTER EXTENSION does not actually pay any attention\nto OUT arguments, since only the input arguments are needed to determine the function's\nidentity. So it is sufficient to list the IN, INOUT, and VARIADIC arguments.\n\nargname\nThe name of a function, procedure, or aggregate argument. Note that ALTER EXTENSION does\nnot actually pay any attention to argument names, since only the argument data types are\nneeded to determine the function's identity.\n\nargtype\nThe data type of a function, procedure, or aggregate argument.\n\nlefttype\nrighttype\nThe data type(s) of the operator's arguments (optionally schema-qualified). Write NONE\nfor the missing argument of a prefix operator.\n\nPROCEDURAL\nThis is a noise word.\n\ntypename\nThe name of the data type of the transform.\n\nlangname\nThe name of the language of the transform.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "To update the hstore extension to version 2.0:\n\nALTER EXTENSION hstore UPDATE TO '2.0';\n\nTo change the schema of the hstore extension to utils:\n\nALTER EXTENSION hstore SET SCHEMA utils;\n\nTo add an existing function to the hstore extension:\n\nALTER EXTENSION hstore ADD FUNCTION populaterecord(anyelement, hstore);\n",
                "subsections": []
            },
            "COMPATIBILITY": {
                "content": "ALTER EXTENSION is a PostgreSQL extension.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "CREATE EXTENSION (CREATEEXTENSION(7)), DROP EXTENSION (DROPEXTENSION(7))\n\n\n\nPostgreSQL 14.23                                2026                              ALTER EXTENSION(7)",
                "subsections": []
            }
        }
    }
}