You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ba...@apache.org on 2005/06/30 21:39:51 UTC

svn commit: r208668 - in /incubator/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ testing/org/apache/derbyTesting/fu...

Author: bandaram
Date: Thu Jun 30 12:39:49 2005
New Revision: 208668

URL: http://svn.apache.org/viewcvs?rev=208668&view=rev
Log:
Derby-405: Disable using synonyms in SESSION schemas, to avoid confusion over temporary tables.

Submitted by Satheesh Bandaram (satheesh@sourcery.org)

Modified:
    incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/synonym.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/synonym.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/synonym.out
    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/synonym.sql

Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java?rev=208668&r1=208667&r2=208668&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CreateAliasNode.java Thu Jun 30 12:39:49 2005
@@ -251,6 +251,11 @@
 		if (aliasType != AliasInfo.ALIAS_TYPE_SYNONYM_AS_CHAR)
 			return this;
 
+		// Don't allow creating synonyms in SESSION schema. Causes confusion if
+		// a temporary table is created later with same name.
+		if (isSessionSchema(getSchemaDescriptor().getSchemaName()))
+			throw StandardException.newException(SQLState.LANG_OPERATION_NOT_ALLOWED_ON_SESSION_SCHEMA_TABLES);
+
 		String targetSchema = ((SynonymAliasInfo)aliasInfo).getSynonymSchema();
 		String targetTable = ((SynonymAliasInfo)aliasInfo).getSynonymTable();
 		if (this.getObjectName().equals(targetSchema, targetTable))

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/synonym.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/synonym.out?rev=208668&r1=208667&r2=208668&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/synonym.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/synonym.out Thu Jun 30 12:39:49 2005
@@ -76,6 +76,9 @@
 ERROR XCL51: The requested function can not reference tables in SESSION schema.
 ij> create synonym synForTemp for session."T1";
 ERROR XCL51: The requested function can not reference tables in SESSION schema.
+ij> -- Synonyms can't be created in session schemas
+create synonym session.table1 for APP.table1;
+ERROR XCL51: The requested function can not reference tables in SESSION schema.
 ij> -- Creating a table or a view when a synonym of that name is present. Error.
 create synonym myTable for table1;
 0 rows inserted/updated/deleted

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/synonym.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/synonym.out?rev=208668&r1=208667&r2=208668&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/synonym.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/synonym.out Thu Jun 30 12:39:49 2005
@@ -76,6 +76,9 @@
 ERROR XCL51: The requested function can not reference tables in SESSION schema.
 ij> create synonym synForTemp for session."T1";
 ERROR XCL51: The requested function can not reference tables in SESSION schema.
+ij> -- Synonyms can't be created in session schemas
+create synonym session.table1 for APP.table1;
+ERROR XCL51: The requested function can not reference tables in SESSION schema.
 ij> -- Creating a table or a view when a synonym of that name is present. Error.
 create synonym myTable for table1;
 0 rows inserted/updated/deleted

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/synonym.out
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/synonym.out?rev=208668&r1=208667&r2=208668&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/synonym.out (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/synonym.out Thu Jun 30 12:39:49 2005
@@ -76,6 +76,9 @@
 ERROR XCL51: The requested function can not reference tables in SESSION schema.
 ij> create synonym synForTemp for session."T1";
 ERROR XCL51: The requested function can not reference tables in SESSION schema.
+ij> -- Synonyms can't be created in session schemas
+create synonym session.table1 for APP.table1;
+ERROR XCL51: The requested function can not reference tables in SESSION schema.
 ij> -- Creating a table or a view when a synonym of that name is present. Error.
 create synonym myTable for table1;
 0 rows inserted/updated/deleted

Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/synonym.sql
URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/synonym.sql?rev=208668&r1=208667&r2=208668&view=diff
==============================================================================
--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/synonym.sql (original)
+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/synonym.sql Thu Jun 30 12:39:49 2005
@@ -45,6 +45,9 @@
 create synonym synForTemp for session.t1;
 create synonym synForTemp for session."T1";
 
+-- Synonyms can't be created in session schemas
+create synonym session.table1 for APP.table1;
+
 -- Creating a table or a view when a synonym of that name is present. Error.
 create synonym myTable for table1;