db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r1616334 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/MergeNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
Date Wed, 06 Aug 2014 20:01:47 GMT
Author: dag
Date: Wed Aug  6 20:01:46 2014
New Revision: 1616334

URL: http://svn.apache.org/r1616334
Log:
DERBY-6689 Assert failure/NPE when using ROW_NUMBER in MERGE ... INSERT

Patch derby-6689. Adds checking for presence of window functions in
the matching clause nodes and throws 42ZC2 is that's the case. Adds a
test case.

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/OLAPTest.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=1616334&r1=1616333&r2=1616334&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 Wed Aug
 6 20:01:46 2014
@@ -385,6 +385,9 @@ public final class MergeNode extends DML
             FromList    dummyFromList = cloneFromList( dd, dflTarget );
             FromBaseTable   dummyTargetTable = (FromBaseTable) dummyFromList.elementAt( TARGET_TABLE_INDEX
);
             mcn.bind( dd, this, dummyFromList, dummyTargetTable );
+
+            // window function not allowed
+            SelectNode.checkNoWindowFunctions(mcn, "matching clause");
         }
         
         bindLeftJoin( dd );

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java?rev=1616334&r1=1616333&r2=1616334&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
Wed Aug  6 20:01:46 2014
@@ -619,6 +619,11 @@ public class OLAPTest extends BaseJDBCTe
             "select * from t3 where y = " +
                 "    (select y from t3 order by row_number() over () fetch first row only)"),
             new String[][]{{"0"}});
+
+        // DERBY-6689: NPE before
+        assertStatementError(LANG_WINDOW_FUNCTION_CONTEXT_ERROR,
+            s,
+            "merge into t2 using t3 on (t2.x=t3.y) when not matched then insert values (row_number()
over ())");
     }
 
 



Mime
View raw message