Contents
ALTER SERVER
An SQL command for modifying the properties of a foreign server
ALTER SERVER
is a DDL command for modifying the properties of a foreign server.
ALTER SERVER
was added in PostgreSQL 8.4.
Change history
- PostgreSQL 9.5
CURRENT_USER
andSESSION_USER
options added toALTER SERVER ... RENAME TO ...
clause (commit 31eae602)
- PostgreSQL 9.2
ALTER SERVER ... RENAME TO ...
clause added (commit 5bcf8ede)
- PostgreSQL 8.4
- added (commit cae565e5)
Examples
Using ALTER SERVER
to modify the options for the foreign server (here: postgres_fdw
):
postgres=# ALTER SERVER pg_fdw_test OPTIONS (ADD use_remote_estimate 'true'); ALTER SERVER postgres=# ALTER SERVER pg_fdw_test OPTIONS (SET use_remote_estimate 'false'); ALTER SERVER postgres=# ALTER SERVER pg_fdw_test OPTIONS (DROP use_remote_estimate); ALTER SERVER
Note that the SET
clause is only accepted if an option was explicitly specified when executing CREATE SERVER
or subsequently specified with ADD
:
postgres=# ALTER SERVER pg_fdw_test OPTIONS (SET use_remote_estimate 'true'); ERROR: option "use_remote_estimate" not found
References
- PostgreSQL documentation: ALTER SERVER