Skip to main content
Version: 1.0.16

ALTER FOREIGN DATA WRAPPER

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_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 general 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. In addition, 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

Specifies that the foreign data wrapper should no longer have a handler function.

Note that foreign tables using 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 the new validator may consider existing options of the foreign data wrapper, or options of independent servers, user mappings, or foreign tables that depend on it, to be invalid. Halo does not perform such checks. It is the user's responsibility to ensure that these options are correct before using the modified foreign data wrapper. However, options specified in this ALTER FOREIGN DATA WRAPPER command will be checked using the new validator.

NO VALIDATOR

Specifies that the foreign data wrapper should no longer have a validator function.

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

Changes options for the foreign data wrapper. ADD, SET, and DROP specify the action to perform. If no operation is explicitly specified, ADD is assumed. Option names must be unique, and option names and values (if any) will also be validated using the foreign data wrapper's validator function.

new_owner

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

new_name

The new name of the foreign data wrapper.

Examples

# Change the foreign data wrapper dbi, add option foo and drop bar:

ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP 'bar');

# Change the validator of the foreign data wrapper dbi to bob.myvalidator:

ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;

See Also

CREATE FOREIGN DATA WRAPPER,DROP FOREIGN DATA WRAPPER