db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r1630242 - in /db/derby/code/branches/10.10: ./ java/engine/org/apache/derby/impl/sql/compile/ java/testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Wed, 08 Oct 2014 21:57:51 GMT
Author: myrnavl
Date: Wed Oct  8 21:57:51 2014
New Revision: 1630242

URL: http://svn.apache.org/r1630242
Log:
DERBY-6690; ROW_NUMBER should not be allowed in generation clause
   backport of revision 1616518 from 10.11 branch

Modified:
    db/derby/code/branches/10.10/   (props changed)
    db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
    db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
    db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java

Propchange: db/derby/code/branches/10.10/
------------------------------------------------------------------------------
  Merged /db/derby/code/branches/10.11:r1616518
  Merged /db/derby/code/trunk:r1616365

Modified: db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java?rev=1630242&r1=1630241&r2=1630242&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
(original)
+++ db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/GenerationClauseNode.java
Wed Oct  8 21:57:51 2014
@@ -28,6 +28,7 @@ import org.apache.derby.iapi.sql.depend.
 import org.apache.derby.iapi.reference.SQLState;
 
 import org.apache.derby.iapi.services.compiler.MethodBuilder;
+import org.apache.derby.iapi.sql.compile.Visitor;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
 import org.apache.derby.iapi.error.StandardException;
@@ -143,7 +144,27 @@ public class GenerationClauseNode extend
         return visitor.getList();
     }
 
-	/*
+    /**
+     * Accept the visitor for all visitable children of this node.
+     *
+     * @param v the visitor
+     *
+     * @exception StandardException on error
+     */
+    void acceptChildren(Visitor v) throws StandardException {
+
+        super.acceptChildren(v);
+
+        if (_generationExpression != null) {
+            _generationExpression = (ValueNode)_generationExpression.accept(v);
+        }
+
+        if (_boundExpression != null) {
+            _boundExpression = (ValueNode)_boundExpression.accept(v);
+        }
+    }
+
+    /*
 		Stringify.
 	 */
 	public String toString()

Modified: db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java?rev=1630242&r1=1630241&r2=1630242&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
(original)
+++ db/derby/code/branches/10.10/java/engine/org/apache/derby/impl/sql/compile/TableElementList.java
Wed Oct  8 21:57:51 2014
@@ -791,6 +791,8 @@ public class TableElementList extends Qu
 				generationTree = generationClauseNode.bindExpression(fromList, (SubqueryList) null,
 										 aggregateVector);
 
+                SelectNode.checkNoWindowFunctions(generationClauseNode, "generation clause");
+
                 //
                 // If the user did not declare a type for this column, then the column type
defaults
                 // to the type of the generation clause.

Modified: db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java?rev=1630242&r1=1630241&r2=1630242&view=diff
==============================================================================
--- db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
(original)
+++ db/derby/code/branches/10.10/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OLAPTest.java
Wed Oct  8 21:57:51 2014
@@ -590,6 +590,18 @@ public class OLAPTest extends BaseJDBCTe
             s,
             "select * from t4 t_1 join t4 t_2 on " +
             "                     t_1.a = row_number() over () + t_2.a");
+
+        // DERBY-6690: a window function in generated clause was not detected
+        // before
+        assertStatementError(LANG_WINDOW_FUNCTION_CONTEXT_ERROR,
+            s,
+            "create table t (x int generated always as " +
+            "    (row_number() over ()))");
+
+        assertStatementError(LANG_WINDOW_FUNCTION_CONTEXT_ERROR,
+            s,
+            "alter table t2 add column foo int generated always as " +
+            "    (row_number() over ())");
     }
 
 



Mime
View raw message