---
title: "ALTER FOREIGN DATA WRAPPER"
url: "https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/ddl_alter_foreign_data_wrapper/"
---

# ALTER FOREIGN DATA WRAPPER

Use the ALTER FOREIGN DATA WRAPPER statement to alter a foreign-data wrapper.

## Synopsis

Use the `ALTER FOREIGN DATA WRAPPER` command to alter the definition of the foreign-data wrapper. This command can be used to alter the handler/validator functions or the options of the foreign-data wrapper. It can also be used to change the owner or rename the foreign-data wrapper.

## Syntax

- [![Grammar Icon](/icons/file-lines.svg)Grammar](#grammar-1)
- [![Diagram Icon](/icons/diagram.svg)Diagram](#diagram-1)

```output.ebnf
alter_foreign_data_wrapper ::= ALTER FOREIGN DATA WRAPPER fdw_name  
                               [ HANDLER handler_name | NO HANDLER ]  
                               [ VALIDATOR validator_name
                                 | NO VALIDATOR ]  
                               [ OPTIONS ( alter_fdw_options ) ]  
                               [ OWNER TO new_owner ]  
                               [ RENAME TO new_name ]
```

#### alter\_foreign\_data\_wrapper

ALTERFOREIGNDATAWRAPPER[fdw\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#fdw-name)HANDLER[handler\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#handler-name)NOHANDLERVALIDATOR[validator\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#validator-name)NOVALIDATOROPTIONS([alter\_fdw\_options](/stable/api/ysql/syntax_resources/grammar_diagrams#alter-fdw-options))OWNERTO[new\_owner](/stable/api/ysql/syntax_resources/grammar_diagrams#new-owner)RENAMETO[new\_name](/stable/api/ysql/syntax_resources/grammar_diagrams#new-name)

## Semantics

Alter the foreign-data wrapper named **fdw\_name**.

### Handler

The `HANDLER` clause can be used to specify the handler function. The `NO HANDLER` clause can be used to specify that the foreign-data wrapper has no handler function.

### Validator

The `VALIDATOR` clause can be used to specify the validator function. The `NO VALIDATOR` can be used to specify that the foreign-data wrapper has no validator function.

### Options

The `OPTIONS` clause can be used to specify the new options of the foreign-data wrapper. `ADD`, `SET`, and `DROP` specify the action to be performed. `ADD` is assumed if no operation is explicitly specified.

The new owner of the FDW can be specified using **new\_owner**

The new name of the FDW can be specified using **new\_name**

## Examples

Change the handler to `newhandler`.

```plpgsql
yugabyte=# ALTER FOREIGN DATA WRAPPER my_wrapper HANDLER;
```

Alter the foreign-data wrapper to have no validator.

```plpgsql
yugabyte=# ALTER FOREIGN DATA WRAPPER my_wrapper NO VALIDATOR;
```

Alter the foreign-data wrapper's options: add `new` and set it to `'1'`, change the value of `old` to `'2'`.

```plpgsql
yugabyte=# ALTER FOREIGN DATA WRAPPER my_wrapper OPTIONS(ADD new '1', SET old '2');
```

## See also

- [CREATE FOREIGN DATA WRAPEPR](/stable/api/ysql/the-sql-language/statements/ddl_create_foreign_data_wrapper/ "CREATE FOREIGN DATA WRAPEPR")
- [DROP FOREIGN DATA WRAPPER](/stable/api/ysql/the-sql-language/statements/ddl_create_foreign_data_wrapper/ "DROP FOREIGN DATA WRAPPER")
