Documentation
 
 
 

CREATE PUBLIC SYNONYM

Name

CREATE PUBLIC SYNONYM -- define a new public synonym

Synopsis

CREATE [ OR REPLACE ] PUBLIC SYNONYM name FOR object    

Description

CREATE PUBLIC SYNONYM defines a public synonym for certain types of database objects. A synonym is an alternate name that can be used to refer to the object. A public synonym is a synonym globally available in the database that can be referenced by any user in the database cluster.

CREATE OR REPLACE PUBLIC SYNONYM is similar, but if a public synonym of the same name already exists, it is replaced.

A synonym is useful in cases where a database object would normally require full qualification by schema name in order to be properly referenced in a SQL statement. A synonym defined for that object simplifies the reference to a single, unqualified name.

Parameters

name

The name of a public synonym to be created.

object

The name (optionally schema-qualified) of a database object for which a public synonym is created. The database object may be a table, view, sequence, or another synonym.

Notes

Any user can create a public synonym - no special permission is required.

A public synonym can be referenced by any user in any SQL statement, however, the statement will only be successfully executed if the user has the proper permissions on the database object referenced by the synonym.

A public synonym is not a member of any schema, but is a database-wide name.

Public synonyms can be created for non-existent objects.

Use the DROP PUBLIC SYNONYM statement to drop public synonyms.

Access to the database object referenced by the public synonym is determined by the permissions of the user of the public synonym. Therefore the public synonym user must have the appropriate permissions on the underlying database object.

Examples

Create a public synonym for the emp table in schema, enterprisedb:

CREATE OR REPLACE PUBLIC SYNONYM personnel FOR enterprisedb.emp;

 
 ©2004-2007 EnterpriseDB All Rights Reserved