# phpman > man > ALTER_FOREIGN_DATA_WRAPPER(7)

ALTER FOREIGN DATA [WRAPPER(7)](https://www.chedong.com/phpMan.php/man/WRAPPER/7/markdown)      PostgreSQL 14.23 Documentation      ALTER FOREIGN DATA [WRAPPER(7)](https://www.chedong.com/phpMan.php/man/WRAPPER/7/markdown)



## NAME
       ALTER_FOREIGN_DATA_WRAPPER - change the definition of a foreign-data wrapper

## SYNOPSIS
       ALTER FOREIGN DATA WRAPPER _name_
           [ HANDLER _handler_function_ | NO HANDLER ]
           [ VALIDATOR _validator_function_ | NO VALIDATOR ]
           [ OPTIONS ( [ ADD | SET | DROP ] _option_ ['_value_'] [, ... ]) ]
       ALTER FOREIGN DATA WRAPPER _name_ OWNER TO { _new_owner_ | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
       ALTER FOREIGN DATA WRAPPER _name_ RENAME TO _new_name_

## DESCRIPTION
       **ALTER** **FOREIGN** **DATA** **WRAPPER** changes the definition of a foreign-data wrapper. The first form
       of the command changes the support functions or the generic options of the foreign-data
       wrapper (at least one clause is required). The second form changes the owner of the
       foreign-data wrapper.

       Only superusers can alter foreign-data wrappers. Additionally, only superusers can own
       foreign-data wrappers.

## PARAMETERS
       _name_
           The name of an existing foreign-data wrapper.

       HANDLER _handler_function_
           Specifies a new handler function for the foreign-data wrapper.

       NO HANDLER
           This is used to specify that the foreign-data wrapper should no longer have a handler
           function.

           Note that foreign tables that use a foreign-data wrapper with no handler cannot be
           accessed.

       VALIDATOR _validator_function_
           Specifies a new validator function for the foreign-data wrapper.

           Note that it is possible that pre-existing options of the foreign-data wrapper, or of
           dependent servers, user mappings, or foreign tables, are invalid according to the new
           validator.  PostgreSQL does not check for this. It is up to the user to make sure that
           these options are correct before using the modified foreign-data wrapper. However, any
           options specified in this **ALTER** **FOREIGN** **DATA** **WRAPPER** command will be checked using the
           new validator.

       NO VALIDATOR
           This is used to specify that the foreign-data wrapper should no longer have a validator
           function.

       OPTIONS ( [ ADD | SET | DROP ] _option_ ['_value_'] [, ... ] )
           Change options for the foreign-data wrapper.  ADD, SET, and DROP specify the action to be
           performed.  ADD is assumed if no operation is explicitly specified. Option names must be
           unique; names and values are also validated using the foreign data wrapper's validator
           function, if any.

       _new_owner_
           The user name of the new owner of the foreign-data wrapper.

       _new_name_
           The new name for the foreign-data wrapper.

## 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;

## COMPATIBILITY
       **ALTER** **FOREIGN** **DATA** **WRAPPER** conforms to ISO/IEC 9075-9 (SQL/MED), except that the HANDLER,
       VALIDATOR, OWNER TO, and RENAME clauses are extensions.

## SEE ALSO
       CREATE FOREIGN DATA WRAPPER (**CREATE**___**FOREIGN**___**DATA**___**[WRAPPER**(7)](https://www.chedong.com/phpMan.php/man/WRAPPER/7/markdown)), DROP FOREIGN DATA WRAPPER
       (**DROP**___**FOREIGN**___**DATA**___**[WRAPPER**(7)](https://www.chedong.com/phpMan.php/man/WRAPPER/7/markdown))



PostgreSQL 14.23                                2026                   ALTER FOREIGN DATA [WRAPPER(7)](https://www.chedong.com/phpMan.php/man/WRAPPER/7/markdown)
