db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r637963 - in /db/derby/code/branches/10.4/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 Mon, 17 Mar 2008 16:38:46 GMT
Author: kmarsden
Date: Mon Mar 17 09:38:37 2008
New Revision: 637963

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


Modified:
    db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
    db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
    db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql

Modified: db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java?rev=637963&r1=637962&r2=637963&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
(original)
+++ db/derby/code/branches/10.4/java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java
Mon Mar 17 09:38:37 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/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/insert.out?rev=637963&r1=637962&r2=637963&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
(original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
Mon Mar 17 09:38:37 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/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql?rev=637963&r1=637962&r2=637963&view=diff
==============================================================================
--- db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql
(original)
+++ db/derby/code/branches/10.4/java/testing/org/apache/derbyTesting/functionTests/tests/lang/insert.sql
Mon Mar 17 09:38:37 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