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 da...@apache.org on 2014/08/07 17:48:26 UTC
svn commit: r1616513 - in /db/derby/code/branches/10.11: ./
java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
Author: dag
Date: Thu Aug 7 15:48:26 2014
New Revision: 1616513
URL: http://svn.apache.org/r1616513
Log:
DERBY-6689 Assert failure/NPE when using ROW_NUMBER in MERGE ... INSERT
Backported cleanly from trunk as:
svn merge -c 1616334 https://svn.apache.org/repos/asf/db/derby/code/trunk
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/branches/10.11/ (props changed)
db/derby/code/branches/10.11/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
db/derby/code/branches/10.11/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
Propchange: db/derby/code/branches/10.11/
------------------------------------------------------------------------------
Merged /db/derby/code/trunk:r1616334
Modified: db/derby/code/branches/10.11/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.11/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java?rev=1616513&r1=1616512&r2=1616513&view=diff
==============================================================================
--- db/derby/code/branches/10.11/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java (original)
+++ db/derby/code/branches/10.11/java/engine/org/apache/derby/impl/sql/compile/MergeNode.java Thu Aug 7 15:48:26 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/branches/10.11/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.11/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java?rev=1616513&r1=1616512&r2=1616513&view=diff
==============================================================================
--- db/derby/code/branches/10.11/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java (original)
+++ db/derby/code/branches/10.11/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java Thu Aug 7 15:48:26 2014
@@ -593,6 +593,11 @@ public class OLAPTest extends BaseJDBCTe
LANG_WINDOW_FUNCTION_CONTEXT_ERROR,
s,
"update t3 set y = y - row_number() over ()");
+
+ // 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 ())");
}