DROP SYNONYM v17

Name

DROP SYNONYM  Remove a synonym.

Synopsis

DROP [PUBLIC] SYNONYM [<schema>.]<syn_name>

Description

DROP SYNONYM deletes existing synonyms. To execute this command, you must be a superuser or the owner of the synonym and have USAGE privileges on the schema in which the synonym resides.

Parameters

syn_name

The name of the synonym. A synonym name must be unique in a schema.

schema

The name of the schema where the synonym resides.

Like any other object that can be schema qualified, you can have two synonyms with the same name in your search path. To specify the name of the synonym that you're dropping, include a schema name. Unless a synonym is schema qualified in the DROP SYNONYM command, EDB Postgres Advanced Server deletes the first instance of the synonym it finds in your search path.

You can optionally include the PUBLIC clause to drop a synonym that resides in the public schema. The DROP PUBLIC SYNONYM command, compatible with Oracle databases, drops a synonym that resides in the public schema:

DROP PUBLIC SYNONYM syn_name;

Examples

This example drops the synonym personnel:

DROP SYNONYM personnel;

See also

CREATE SYNONYM