{
    "mode": "man",
    "parameter": "ALTER_FOREIGN_DATA_WRAPPER",
    "section": "7",
    "url": "https://www.chedong.com/phpMan.php/man/ALTER_FOREIGN_DATA_WRAPPER/7/json",
    "generated": "2026-06-15T18:53:28Z",
    "synopsis": "ALTER FOREIGN DATA WRAPPER name\n[ HANDLER handlerfunction | NO HANDLER ]\n[ VALIDATOR validatorfunction | NO VALIDATOR ]\n[ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ]\nALTER FOREIGN DATA WRAPPER name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER FOREIGN DATA WRAPPER name RENAME TO newname",
    "sections": {
        "NAME": {
            "content": "ALTERFOREIGNDATAWRAPPER - change the definition of a foreign-data wrapper\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ALTER FOREIGN DATA WRAPPER name\n[ HANDLER handlerfunction | NO HANDLER ]\n[ VALIDATOR validatorfunction | NO VALIDATOR ]\n[ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ]\nALTER FOREIGN DATA WRAPPER name OWNER TO { newowner | CURRENTROLE | CURRENTUSER | SESSIONUSER }\nALTER FOREIGN DATA WRAPPER name RENAME TO newname\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "ALTER FOREIGN DATA WRAPPER changes the definition of a foreign-data wrapper. The first form\nof the command changes the support functions or the generic options of the foreign-data\nwrapper (at least one clause is required). The second form changes the owner of the\nforeign-data wrapper.\n\nOnly superusers can alter foreign-data wrappers. Additionally, only superusers can own\nforeign-data wrappers.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "name\nThe name of an existing foreign-data wrapper.\n\nHANDLER handlerfunction\nSpecifies a new handler function for the foreign-data wrapper.\n\nNO HANDLER\nThis is used to specify that the foreign-data wrapper should no longer have a handler\nfunction.\n\nNote that foreign tables that use a foreign-data wrapper with no handler cannot be\naccessed.\n\nVALIDATOR validatorfunction\nSpecifies a new validator function for the foreign-data wrapper.\n\nNote that it is possible that pre-existing options of the foreign-data wrapper, or of\ndependent servers, user mappings, or foreign tables, are invalid according to the new\nvalidator.  PostgreSQL does not check for this. It is up to the user to make sure that\nthese options are correct before using the modified foreign-data wrapper. However, any\noptions specified in this ALTER FOREIGN DATA WRAPPER command will be checked using the\nnew validator.\n\nNO VALIDATOR\nThis is used to specify that the foreign-data wrapper should no longer have a validator\nfunction.\n\nOPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] )\nChange options for the foreign-data wrapper.  ADD, SET, and DROP specify the action to be\nperformed.  ADD is assumed if no operation is explicitly specified. Option names must be\nunique; names and values are also validated using the foreign data wrapper's validator\nfunction, if any.\n\nnewowner\nThe user name of the new owner of the foreign-data wrapper.\n\nnewname\nThe new name for the foreign-data wrapper.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Change a foreign-data wrapper dbi, add option foo, drop bar:\n\nALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP bar);\n\nChange the foreign-data wrapper dbi validator to bob.myvalidator:\n\nALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;\n",
            "subsections": []
        },
        "COMPATIBILITY": {
            "content": "ALTER FOREIGN DATA WRAPPER conforms to ISO/IEC 9075-9 (SQL/MED), except that the HANDLER,\nVALIDATOR, OWNER TO, and RENAME clauses are extensions.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "CREATE FOREIGN DATA WRAPPER (CREATEFOREIGNDATAWRAPPER(7)), DROP FOREIGN DATA WRAPPER\n(DROPFOREIGNDATAWRAPPER(7))\n\n\n\nPostgreSQL 14.23                                2026                   ALTER FOREIGN DATA WRAPPER(7)",
            "subsections": []
        }
    },
    "summary": "ALTERFOREIGNDATAWRAPPER - change the definition of a foreign-data wrapper",
    "flags": [],
    "examples": [
        "Change a foreign-data wrapper dbi, add option foo, drop bar:",
        "ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP bar);",
        "Change the foreign-data wrapper dbi validator to bob.myvalidator:",
        "ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;"
    ],
    "see_also": [
        {
            "name": "CREATEFOREIGNDATAWRAPPER",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/CREATEFOREIGNDATAWRAPPER/7/json"
        },
        {
            "name": "DROPFOREIGNDATAWRAPPER",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/DROPFOREIGNDATAWRAPPER/7/json"
        },
        {
            "name": "WRAPPER",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/WRAPPER/7/json"
        }
    ]
}