Help Center> GaussDB> Centralized_3.x> SQL Reference> SQL Syntax> ALTER FOREIGN DATA WRAPPER
Updated on 2024-05-07 GMT+08:00

ALTER FOREIGN DATA WRAPPER

Description

Modifies the definition of a foreign data wrapper.

Precautions

  • Only initial users and system administrators can modify the foreign data wrapper.
  • The alter statement can be successfully executed only when support_extended_features is set to on.

Syntax

  • Set the attributes of the foreign data wrapper.
    ALTER FOREIGN DATA WRAPPER name
    [ HANDLER handler_function | NO HANDLER ]
    [ VALIDATOR validator_function | NO VALIDATOR ]
    [ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ];
  • Set a new owner.
    ALTER FOREIGN DATA WRAPPER name OWNER TO new_owner;
  • Set a new name.
    ALTER FOREIGN DATA WRAPPER name RENAME TO new_name;

Parameters

  • name

    Specifies a name of an existing foreign data wrapper.

  • HANDLER handler_function

    Specifies a new handler function for a foreign data wrapper.

  • NO HANDLER

    Specifies that the foreign data wrapper no longer has the handler function.

    Foreign tables that use foreign data wrapper but do not have handlers cannot be accessed.

  • VALIDATOR validator_function

    Specifies a new validator function for a foreign data wrapper.

    Depending on the new validator, an existing option for the foreign data wrapper or dependent server, user mapping, or foreign table may be invalid. Before using foreign data wrapper, ensure that these options are correct. However, any options specified in the ALTER FOREIGN DATA WRAPPER command will be checked using the new validator function.

  • NO VALIDATOR

    Specifies that the foreign data wrapper no longer has the validator function.

  • OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] )

    Modifies the options of a foreign data wrapper. ADD, SET, and DROP specify the actions to be performed. If no operation is specified, the default operation is ADD. The option name must be unique. When foreign data is used to wrap validator functions, names and values are also validated.

  • new_owner

    Specifies the username of the new owner for a foreign data wrapper.

  • new_name

    Specifies the new name of a foreign data wrapper.

Example

-- Modify a foreign data wrapper dbi, add the foo option, and delete bar.
gaussdb=# ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP 'bar');

-- Change the validator of the foreign data wrapper dbi to bob.myvalidator.
gaussdb=# ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;