Deletes a synonym from the database.
Prerequisites
Before you drop a synonym, ensure that you have:
Ownership of the synonym
The
USAGEprivilege on the schema where the synonym resides
Syntax
DROP [PUBLIC] SYNONYM [schema.]syn_nameParameters
| Parameter | Description |
|---|---|
PUBLIC | Drops a synonym that resides in the public schema. |
schema | The schema that contains the synonym. |
syn_name | The name of the synonym to drop. Synonym names must be unique within a schema. |
Usage notes
Schema resolution without a qualifier
If two synonyms with the same name exist in your search path, PolarDB for PostgreSQL (Compatible with Oracle) drops the first one found. To target a specific synonym, qualify its name with a schema:
DROP SYNONYM myschema.personnel;Dropping a public synonym
Use DROP PUBLIC SYNONYM to drop a synonym in the public schema. The schema qualifier is not allowed with PUBLIC:
DROP PUBLIC SYNONYM personnel;Examples
The following example drops the personnel synonym:
DROP SYNONYM personnel;