db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r636872 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/ResultColumnList.java testing/org/apache/derbyTesting/functionTests/master/insert.out testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql
Date Thu, 13 Mar 2008 20:37:38 GMT
Author: kmarsden
Date: Thu Mar 13 13:37:36 2008
New Revision: 636872

URL: http://svn.apache.org/viewvc?rev=636872&view=rev
Log:
DERBY-3310 ASSERT in MergeSort.checkColumnTypes() disallow legal type conversions

Changed copyTypesAndLengthsToSource to not change the type of the
underlying expression,  because that same expression is pointed to
by the child result set's result column list.  Only NormalizeResultSetNode
should have a   type that is different than its expresssion.
See Army's write up attached to DERBY-3310 for a detailed analysis of the
 role of copyTypesAndLengthsToSource.


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/master/insert.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql

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=636872&r1=636871&r2=636872&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
Thu Mar 13 13:37:36 2008
@@ -1647,6 +1647,15 @@
 	 * Copy the types and lengths for this RCL (the target)
 	 * to another RCL (the source).  
 	 * This is useful when adding a NormalizeResultSetNode.
+	 * It is called on the NormalizeResultSetNode to copy 
+	 * the types from the insert or update ResultColumnList (sourceRCL).
+	 * The type of the underlying expression should not be changed 
+	 * (DERBY-3310)
+	 * because that same expression is pointed to by the child result set's
+	 * result column list.  Only NormalizeResultSetNode should have a 
+	 * type that is different than its expresssion. See Army's write up
+	 * attached to DERBY-3310 for a detailed analysis of the role of 
+	 * copyTypesAndLengthsToSource.
 	 *
 	 * @param sourceRCL	The source RCL
 	 */
@@ -1659,7 +1668,6 @@
 			ResultColumn sourceRC = (ResultColumn) sourceRCL.elementAt(index);
 			ResultColumn resultColumn = (ResultColumn) elementAt(index);
 			sourceRC.setType(resultColumn.getTypeServices());
-			sourceRC.getExpression().setType(resultColumn.getTypeServices());
 		}
 	}
 		

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/insert.out?rev=636872&r1=636871&r2=636872&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
Thu Mar 13 13:37:36 2008
@@ -791,4 +791,29 @@
 356        
 ij> drop table POLICY_STATEMENTS;
 0 rows inserted/updated/deleted
+ij> -- DERBY-3310 type conversions in insert
+
+create table  U (SNAME varchar(32000), TNAME Varchar(32000), C1 bigint);
+0 rows inserted/updated/deleted
+ij> insert into U(SNAME, TNAME, C1) select distinct SCHEMANAME, TABLENAME, 2
+ from SYS.SYSTABLES T join  SYS.SYSSCHEMAS S on T.SCHEMAID = S.SCHEMAID where TABLENAME =
'U';
+1 row inserted/updated/deleted
+ij> select * from U;
+SNAME                                                                                   
                                       |TNAME                                            
                                                                              |C1        
         
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+APP                                                                                     
                                       |U                                                
                                                                              |2         
         
+ij> drop table  U;
+0 rows inserted/updated/deleted
+ij> create table d3310 (x bigint);
+0 rows inserted/updated/deleted
+ij> insert into d3310 select distinct * from (values 2.0, 2.1, 2.2) v;
+3 rows inserted/updated/deleted
+ij> select * from d3310;
+X                   
+--------------------
+2                   
+2                   
+2                   
+ij> drop table d3310;
+0 rows inserted/updated/deleted
 ij> 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql?rev=636872&r1=636871&r2=636872&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql
Thu Mar 13 13:37:36 2008
@@ -622,3 +622,22 @@
 select count(*) from POLICY_STATEMENTS;
 
 drop table POLICY_STATEMENTS;
+
+-- DERBY-3310 type conversions in insert
+
+create table  U (SNAME varchar(32000), TNAME Varchar(32000), C1 bigint);
+insert into U(SNAME, TNAME, C1) select distinct SCHEMANAME, TABLENAME, 2
+ from SYS.SYSTABLES T join  SYS.SYSSCHEMAS S on T.SCHEMAID = S.SCHEMAID where TABLENAME =
'U';
+select * from U;
+drop table  U;
+
+create table d3310 (x bigint);
+insert into d3310 select distinct * from (values 2.0, 2.1, 2.2) v;
+select * from d3310;
+drop table d3310;
+
+
+
+
+
+



Mime
View raw message