db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1570352 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/MergeNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java
Date Thu, 20 Feb 2014 20:57:09 GMT
Author: rhillegas
Date: Thu Feb 20 20:57:08 2014
New Revision: 1570352

URL: http://svn.apache.org/r1570352
Log:
DERBY-3155: Remove some obsolete code which was causing a cross-schema MERGE statement to
raise a missing schema error: commit derby-3155-29-aa-missingSchema.diff.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java?rev=1570352&r1=1570351&r2=1570352&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java Thu Feb
20 20:57:08 2014
@@ -633,22 +633,12 @@ public final class MergeNode extends DML
     void    addColumn
         (
          HashMap<String,ColumnReference> map,
-         ColumnReference    originalCR,
+         ColumnReference    cr,
          int    mergeTableID
          )
         throws StandardException
     {
-        ColumnReference cr = originalCR;
-        
-        if ( cr.getTableName() == null )
-        {
-            ResultColumn    rc = _leftJoinFromList.bindColumnReference( cr );
-            TableName       tableName = new TableName( null, rc.getTableName(), getContextManager()
);
-            cr = new ColumnReference( cr.getColumnName(), tableName, getContextManager()
);
-        }
-
         associateColumn( cr, mergeTableID );
-        originalCR.setMergeTableID( cr.getMergeTableID() );
 
         String  key = makeDCMKey( cr.getTableName(), cr.getColumnName() );
         if ( map.get( key ) == null )

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java?rev=1570352&r1=1570351&r2=1570352&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java
Thu Feb 20 20:57:08 2014
@@ -5631,6 +5631,71 @@ public class MergeStatementTest extends 
         goodStatement( dboConnection, "drop table t3_041" );
     }
     
+   /**
+     * <p>
+     * Verify that we don't unnecessarily raise missing schema errors.
+     * </p>
+     */
+    public  void    test_042_missingSchema()
+        throws Exception
+    {
+        Connection  dboConnection = openUserConnection( TEST_DBO );
+        Connection  ruthConnection = openUserConnection( RUTH );
+
+        //
+        // create schema
+        //
+        goodStatement
+            (
+             dboConnection,
+             "create table deleteTable_042\n" +
+             "(\n" +
+             "    publicSelectColumn int\n" +
+             ")\n"
+             );
+        goodStatement
+            (
+             dboConnection,
+             "create table selectTable_042\n" +
+             "(\n" +
+             "    selectColumn int\n" +
+             ")\n"
+             );
+        goodStatement
+            (
+             dboConnection,
+             "grant select on  selectTable_042 to public"
+             );
+        goodStatement
+            (
+             dboConnection,
+             "grant select on  deleteTable_042 to public"
+             );
+        goodStatement
+            (
+             dboConnection,
+             "grant delete on deleteTable_042 to ruth"
+             );
+
+        //
+        // Verify that the unqualified reference to publicSelectColumn
+        // does not fail because the RUTH schema does not exist.
+        //
+        String  mergeStatement =
+            "merge into test_dbo.deleteTable_042\n" +
+            "using test_dbo.selectTable_042\n" +
+            "on publicSelectColumn = selectColumn\n" +
+            "when matched then delete\n";
+        expectExecutionWarning( ruthConnection, NO_ROWS_AFFECTED, mergeStatement );
+        expectExecutionWarning( dboConnection, NO_ROWS_AFFECTED, mergeStatement );
+
+        //
+        // drop schema
+        //
+        goodStatement( dboConnection, "drop table deleteTable_042" );
+        goodStatement( dboConnection, "drop table selectTable_042" );
+    }
+    
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // ROUTINES



Mime
View raw message