3.17.1 Specification format and rules for the DROP SERVER statement
Delete foreign servers. Deleting a foreign server affects foreign tables and viewed tables as follows:
-
Foreign tables using the foreign server to be deleted will also be deleted.
-
Viewed tables (viewed tables of other schemas) that depend on a foreign table are deleted (or invalidated).
- Organization of this subsection
(1) Specification format
DROP SERVER-statement ::= DROP SERVER foreign-server-name [drop-behavior]
drop-behavior ::= {CASCADE|RESTRICT}
(2) Explanation of specification format
- ● foreign-server-name
-
Specifies the name of the foreign server to be deleted. For rules for specifying foreign server names, see (2) Rules for characters that can be used in names in 6.1.4 Specifying names.
Note that the name of an undefined foreign server cannot be specified.
- ● drop-behavior
-
drop-behavior ::= {CASCADE|RESTRICT}Specifies whether to delete the foreign server if there is a foreign table that uses the foreign server to be deleted. The following table describes the specifications for drop-behavior.
Specification of drop-behavior
Description
Handling of viewed tables that depend on the foreign table to be deleted
If drop-behavior is omitted
Deletes a foreign server even if there is an foreign table using the foreign server to be deleted. In this case, the foreign tables using the foreign server to be deleted are also deleted.
The viewed tables that depend on the deleted foreign table are invalidated. Not only the viewed table of its own schema, but also those of other schemas will be invalidated.
If CASCADE is specified
The viewed tables that depend on the deleted foreign table are deleted. Not only the viewed table of its own schema, but also those of other schemas will be deleted.
If RESTRICT is specified
If there is a foreign table using the foreign server to be deleted, the DROP SERVER statement results in an error.
The viewed tables in other schemata are not affected because the DROP SERVER statement results in an error.
(3) Privileges required at execution
To execute the DROP SERVER statement, the CONNECT privilege and the DBA privilege are required.
(4) Rules
A user (the HADB user with the authorization identifier that was used for the current connection to the HADB server) can delete only those foreign servers defined by that user. You cannot delete a foreign server defined by another HADB user.
(5) Examples
- Examples
-
Delete a foreign server (FOREIGNSERVER1).
DROP SERVER "FOREIGNSERVER1"