db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r896388 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Wed, 06 Jan 2010 11:09:29 GMT
Author: dag
Date: Wed Jan  6 11:09:29 2010
New Revision: 896388

URL: http://svn.apache.org/viewvc?rev=896388&view=rev
Log:
DERBY-4496 Column list size mismatch with ORDER BY in INSERT statement

Fixed this issue which was due to missed occurences of RCL.size() that
now (with ORDER BY in subqueries) need to be generalized to
RCL.visibleSize to be able to ignore synthesized columns. Added a new
test case for the failing repro. Also wired the OrderByInSubqueries
test into the regression suite.


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

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=896388&r1=896387&r2=896388&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
Wed Jan  6 11:09:29 2010
@@ -646,16 +646,19 @@
 		 */
 		if (SanityManager.DEBUG)
 		{
-			 if ((! countMismatchAllowed) && visibleSize() != nameList.size())
+             if ( (! countMismatchAllowed) &&
+                  visibleSize() != nameList.visibleSize() )
 			 {
 				SanityManager.THROWASSERT(
 					"The size of the 2 lists is expected to be the same. " +
 					"visibleSize() = " + visibleSize() +
-					", nameList.size() = " + nameList.size());
+                    ", nameList.visibleSize() = " + nameList.visibleSize());
 			 }
 		 }
 
-		int size = (countMismatchAllowed) ? nameList.size() : visibleSize();
+        int size =
+            (countMismatchAllowed) ? nameList.visibleSize() : visibleSize();
+
 		for (int index = 0; index < size; index++)
 		{
 			ResultColumn thisResultColumn = (ResultColumn) elementAt(index);
@@ -2050,7 +2053,7 @@
 		if (derivedRCL.size() != size() &&
 		    ! derivedRCL.getCountMismatchAllowed())
 		{
-			if (visibleSize() != derivedRCL.size()) {
+            if (visibleSize() != derivedRCL.visibleSize()) {
 				throw StandardException.newException(SQLState.LANG_DERIVED_COLUMN_LIST_MISMATCH, tableName);
 			}
 		}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OrderByInSubqueries.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OrderByInSubqueries.java?rev=896388&r1=896387&r2=896388&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OrderByInSubqueries.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/OrderByInSubqueries.java
Wed Jan  6 11:09:29 2010
@@ -288,6 +288,16 @@
                 {"8", null},
                 {"1", null}});
 
+        // DERBY-4496
+        s.executeUpdate("create table t4496(x varchar(100))");
+        s.execute("insert into t4496(x) select ibmreqd from " +
+                  "    (select * from sysibm.sysdummy1" +
+                  "         order by length(ibmreqd)) t1");
+
+        JDBC.assertFullResultSet(
+            s.executeQuery("select * from t4496"),
+            new String[][]{{"Y"}});
+
         rollback();
     }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=896388&r1=896387&r2=896388&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Wed Jan  6 11:09:29 2010
@@ -207,6 +207,7 @@
         suite.addTest(UserLobTest.suite());
         suite.addTest(OffsetFetchNextTest.suite());
         suite.addTest(SequenceTest.suite());
+        suite.addTest(OrderByInSubqueries.suite());
         suite.addTest(OLAPTest.suite());
 
         return suite;



Mime
View raw message