db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject Re: [PATCH] Synonym support in Derby.
Date Thu, 02 Jun 2005 02:22:33 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I am attaching the patch here. Let me know if you have any comments.<br>
<br>
I will also be adding more test cases with my next patch.<br>
<br>
Satheesh<br>
<br>
Satheesh Bandaram wrote:<br>
<blockquote cite="mid429D86BB.9030804@Sourcery.Org" type="cite">
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
Hi<br>
  <br>
I am attaching a patch that adds SYNONYM support to Derby.&nbsp; 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.<br>
  <br>
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 <b>not</b>
support creating aliases. Synonyms are <b>not </b>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. We all know and love CREATE INDEX statement, which is
also not part of the standard.<br>
  <br>
This current patch leaves out some changes that are needed. I will
submit these in another patch:<br>
  <ol>
    <li><b>dblook</b> changes. This schema generating tool needs to be
modified to emit synonym information in the catalog.</li>
    <li>Registering and enforcing dependencies. Droping a synonym, for
example, should invalidate all cached plans that use them. This is
achieved by registering and enforcing dependencies using
DependencyManager.<br>
    </li>
  </ol>
Let me know if you have any comments or suggestions. My vote is <b>+1</b>,
to accept this patch.<br>
  <br>
Satheesh<br>
  <br>
[bandaram:satheesh] <b>svn stat</b><br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\impl\sql\compile\NodeFactoryImpl.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\impl\sql\compile\DropAliasNode.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\impl\sql\compile\QueryTreeNode.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\impl\sql\compile\CreateTableNode.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\impl\sql\compile\LockTableNode.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\impl\sql\compile\FromBaseTable.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\impl\sql\compile\DMLModStatementNode.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\impl\sql\compile\CreateAliasNode.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\impl\sql\compile\sqlgrammar.jj<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\impl\sql\compile\CreateViewNode.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\impl\sql\execute\DropAliasConstantAction.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\impl\sql\execute\CreateAliasConstantAction.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\impl\sql\catalog\SYSALIASESRowFactory.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\iapi\sql\compile\NodeFactory.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\iapi\sql\dictionary\AliasDescriptor.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\iapi\services\io\RegisteredFormatIds.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\engine\org\apache\derby\iapi\services\io\StoredFormatIds.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\iapi\reference\SQLState.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\catalog\AliasInfo.java<br>
A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\catalog\types\SynonymAliasInfo.java<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; java\engine\org\apache\derby\loc\messages_en.properties<br>
M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\testing\org\apache\derbyTesting\functionTests\tests\lang\copyfiles.ant<br>
A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\testing\org\apache\derbyTesting\functionTests\tests\lang\synonym.sql<br>
A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
java\testing\org\apache\derbyTesting\functionTests\master\synonym.out<br>
[bandaram:satheesh]<br>
</blockquote>
</body>
</html>

Mime
View raw message