DROP SYNONYM

Function

DROP SYNONYM deletes a synonym.

Precautions

The owner of SYNONYM or a user granted with the DROP ANY SEQUENCE permission can run DROP SYNONYM. The system administrator has this permission by default.

The PUBLIC SYNONYM can only be deleted by a user granted with the DROP PUBLIC SYNONYM permission.

Syntax

DROP [ PUBLIC ] SYNONYM [ IF EXISTS ] synonym_name [ CASCADE | RESTRICT ];

Parameter Description

  • PUBLIC

    Deletes a public synonym. If you do not specify PUBLIC, a private synonym is deleted.

  • IF EXISTS

    Reports a notice instead of an error if the specified synonym does not exist.

  • synonym_name

    Specifies the name (optionally schema-qualified) of the synonym to be deleted.

  • CASCADE | RESTRICT

    • CASCADE: automatically deletes the objects (such as views) that depend on the synonym.
    • RESTRICT: refuses to delete the synonym if any objects depend on it. This is the default action.

Examples

See Examples in CREATE SYNONYM.

Helpful Links

ALTER SYNONYM and CREATE SYNONYM

Feedback
编组 3备份
    openGauss 2025-06-14 07:42:20
    cancel