Enhance Derby by adding SYNONYM support. A synonym is an alternate name for a 
view or a table.
----------------------------------------------------------------------------------------------

         Key: DERBY-335
         URL: http://issues.apache.org/jira/browse/DERBY-335
     Project: Derby
        Type: New Feature
  Components: SQL  
    Versions: 10.1.0.0    
 Environment: Generic
    Reporter: Satheesh Bandaram
 Assigned to: Satheesh Bandaram 
     Fix For: 10.1.0.0


Synonym provides an alternate name for a table or a view that is present in the 
same schema or another schema. A synonym can also be created for another 
synonym, causing nesting of synonyms. A synonym can be used in SELECT, INSERT, 
UPDATE, DELETE or LOCK TABLE statements instead of the original qualified table 
or view name. Note that a synonym can be created for a table or a view that 
doesn't yet exists. But the target table/view must be present before the 
synonym can be used.

Synonyms are supported by all major database vendors, including Oracle, DB2 and 
mySQL. DB2 also allows CREATE ALIAS statement, which does exactly same as 
CREATE SYNONYM. Creating aliases instead of synonyms is not supported by Oracle 
or mySQL, so I propose that Derby not support creating aliases. Synonyms are 
not part of SQL-2003 spec, but is a common-SQL statement among major database 
vendors. SQL standard doesn't pay attention to DDLs as much, so I suspect they 
skipped synonyms. 

I will be adding two new DDL statements to Derby:

CREATE SYNONYM <SynonymSchema>.<SynonymName> FOR <TargetSchema>.<TargetName>
DROP SYNONYM <SynonymSchema>.<SynonymName>

Synonyms share the same namespace as tables or views. It is not possible to 
create a synonym with same name as a table that already exists in the same 
schema. Similarly, a table/view can't be created that matches a synonym already 
present.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to