db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r916631 - in /db/derby/code/branches/10.5: ./ java/engine/org/apache/derby/impl/sql/compile/ java/testing/org/apache/derbyTesting/functionTests/master/ java/testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Fri, 26 Feb 2010 09:51:06 GMT
Author: kahatlen
Date: Fri Feb 26 09:51:06 2010
New Revision: 916631

URL: http://svn.apache.org/viewvc?rev=916631&view=rev
Log:
DERBY-4549: NPE in JBitSet

Merged fix from trunk (revision 911315).

Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out
    db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 26 09:51:06 2010
@@ -1 +1 @@
-/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,835286,881074,881444,882732,884163,887246,892912,897161,901165,901648,901760,903108,915733
+/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,835286,881074,881444,882732,884163,887246,892912,897161,901165,901648,901760,903108,911315,915733

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java?rev=916631&r1=916630&r2=916631&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java
(original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/compile/SubqueryNode.java
Fri Feb 26 09:51:06 2010
@@ -571,6 +571,12 @@
 
 		resultSet = resultSet.preprocess(numTables, null, (FromList) null);
 
+        if (leftOperand != null)
+        {
+            leftOperand = leftOperand.preprocess(numTables,
+                    outerFromList, outerSubqueryList, outerPredicateList);
+        }
+
 		// Eliminate any unnecessary DISTINCTs
 		if (resultSet instanceof SelectNode)
 		{

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out?rev=916631&r1=916630&r2=916631&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/master/subquery.out
Fri Feb 26 09:51:06 2010
@@ -1731,4 +1731,45 @@
 ERROR 42X07: Null is only allowed in a VALUES clause within an INSERT statement.
 ij> drop table t1;
 0 rows inserted/updated/deleted
+ij> -- DERBY-4549: NPE in JBitSet
+CREATE TABLE ABC (ID INT);
+0 rows inserted/updated/deleted
+ij> CREATE TABLE DEF (ID INT);
+0 rows inserted/updated/deleted
+ij> -- compilation of the statement used to fail with NPE
+PREPARE PS AS 'SELECT * FROM ABC t1
+WHERE (SELECT DISTINCT t2.ID FROM DEF t2) IN (SELECT t3.ID FROM DEF t3)';
+ij> -- empty tables, empty result
+EXECUTE PS;
+ID         
+-----------
+ij> -- now, test with data in the tables
+INSERT INTO ABC VALUES 1, 2;
+2 rows inserted/updated/deleted
+ij> EXECUTE PS;
+ID         
+-----------
+ij> INSERT INTO DEF VALUES 2;
+1 row inserted/updated/deleted
+ij> EXECUTE PS;
+ID         
+-----------
+1          
+2          
+ij> INSERT INTO DEF VALUES 2;
+1 row inserted/updated/deleted
+ij> EXECUTE PS;
+ID         
+-----------
+1          
+2          
+ij> INSERT INTO DEF VALUES 3;
+1 row inserted/updated/deleted
+ij> -- will fail because left operand of IN is no longer scalar
+EXECUTE PS;
+ERROR 21000: Scalar subquery is only allowed to return a single row.
+ij> DROP TABLE ABC;
+0 rows inserted/updated/deleted
+ij> DROP TABLE DEF;
+0 rows inserted/updated/deleted
 ij> 

Modified: db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql?rev=916631&r1=916630&r2=916631&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql
(original)
+++ db/derby/code/branches/10.5/java/testing/org/apache/derbyTesting/functionTests/tests/lang/subquery.sql
Fri Feb 26 09:51:06 2010
@@ -584,3 +584,24 @@
 select * from t1 where exists (select 1 from (values null) as t2);
 select * from t1 where exists (select * from (values null) as t2);
 drop table t1;
+
+-- DERBY-4549: NPE in JBitSet
+CREATE TABLE ABC (ID INT);
+CREATE TABLE DEF (ID INT);
+-- compilation of the statement used to fail with NPE
+PREPARE PS AS 'SELECT * FROM ABC t1
+WHERE (SELECT DISTINCT t2.ID FROM DEF t2) IN (SELECT t3.ID FROM DEF t3)';
+-- empty tables, empty result
+EXECUTE PS;
+-- now, test with data in the tables
+INSERT INTO ABC VALUES 1, 2;
+EXECUTE PS;
+INSERT INTO DEF VALUES 2;
+EXECUTE PS;
+INSERT INTO DEF VALUES 2;
+EXECUTE PS;
+INSERT INTO DEF VALUES 3;
+-- will fail because left operand of IN is no longer scalar
+EXECUTE PS;
+DROP TABLE ABC;
+DROP TABLE DEF;



Mime
View raw message