Deletes a synonym.
Syntax
DROP [PUBLIC] SYNONYM [schema.]syn_name
Description
You can use the DROP SYNONYM
command to delete existing synonyms. To run this command on a synonym, you must be the owner of the synonym and have the USAGE
privileges on the schema in which the synonym resides.
Parameters
Parameter | Description |
---|
Parameter | Description |
---|---|
syn_name | syn_name is the name of the synonym. A synonym name must be unique within a schema. |
schema | schema specifies the name of the schema where the synonym resides. |
Similar to other objects that can be schema-qualified, you may have two synonyms with the same name in your search path. To disambiguate the name of the synonym to be dropped, include a schema name. Unless a synonym is schema-qualified in the DROP SYNONYM
command, PolarDB for PostgreSQL(Compatible with Oracle) deletes the first instance of the synonym that is found in your search path.
You can optionally add the PUBLIC
clause to drop a synonym that resides in the public schema. The DROP PUBLIC SYNONYM
command is PolarDB for PostgreSQL(Compatible with Oracle) databases and drops a synonym that resides in the public schema:
DROP PUBLIC SYNONYM syn_name;
The following example drops the personnel synonym:
DROP SYNONYM personnel;