You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ma...@apache.org on 2012/09/05 03:42:09 UTC
svn commit: r1380946 - in /db/derby/code/branches/10.7: ./
java/engine/org/apache/derby/impl/store/access/btree/OpenBTree.java
java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Author: mamta
Date: Wed Sep 5 01:42:08 2012
New Revision: 1380946
URL: http://svn.apache.org/viewvc?rev=1380946&view=rev
Log:
DERBY-5445 Enhance existing concurrency test to stress sequence generators to also stress identity columns
Backporting to 10.7
Modified:
db/derby/code/branches/10.7/ (props changed)
db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/access/btree/OpenBTree.java
db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
Propchange: db/derby/code/branches/10.7/
------------------------------------------------------------------------------
Merged /db/derby/code/trunk:r1378206
Modified: db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/access/btree/OpenBTree.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/access/btree/OpenBTree.java?rev=1380946&r1=1380945&r2=1380946&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/access/btree/OpenBTree.java (original)
+++ db/derby/code/branches/10.7/java/engine/org/apache/derby/impl/store/access/btree/OpenBTree.java Wed Sep 5 01:42:08 2012
@@ -513,6 +513,10 @@ public class OpenBTree
for (int i = 0; i < row.length; i++)
{
+ //DERBY-5531 If the row column's value is null, then
+ // don't worry about the data type match.
+ if (row[i].isNull())
+ continue;
// Compare class's rather than format id's to pick up
// different problems with wrong collation implementation.
if (!row[i].getClass().equals(template[i].getClass()))
Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java?rev=1380946&r1=1380945&r2=1380946&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java (original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java Wed Sep 5 01:42:08 2012
@@ -478,6 +478,40 @@ public void testNorwayCollation() throws
}
+/**
+ * DERBY-5531 Assert failure when inserting NULL into indexed column with
+ * territory-based collation
+ * Make sure that when the row being inserted has all nulls, we do not run
+ * into assert failure
+ * @throws SQLException
+ */
+public void testNullColumnInInsert() throws SQLException {
+ Statement s = createStatement();
+ String collation;
+
+ ResultSet rs = null;
+ s.executeUpdate("CREATE TABLE derby5531_t1(x varchar(10) unique, y varchar(10))");
+ s.executeUpdate("INSERT INTO derby5531_t1 VALUES(NULL, 'a')");
+ s.executeUpdate("INSERT INTO derby5531_t1 VALUES('1', 'a')");
+ s.executeUpdate("INSERT INTO derby5531_t1 VALUES('2', NULL)");
+ s.executeUpdate("INSERT INTO derby5531_t1 VALUES(NULL, NULL)");
+ s.executeUpdate("INSERT INTO derby5531_t1(x) VALUES(NULL)");
+ s.executeUpdate("INSERT INTO derby5531_t1 VALUES('3', 'b')");
+ rs = s.executeQuery("select * from derby5531_t1 order by x");
+ JDBC.assertFullResultSet(rs,
+ new String[][] {{"1","a"}, {"2",null}, {"3","b"}, {null,null}, {null,null}, {null,"a"}});
+ s.executeUpdate("DROP TABLE derby5531_t1");
+
+ s.executeUpdate("CREATE TABLE derby5531_t2(x varchar(10) unique)");
+ s.executeUpdate("INSERT INTO derby5531_t2 VALUES(NULL)");
+ s.executeUpdate("INSERT INTO derby5531_t2(x) VALUES(NULL)");
+ s.executeUpdate("INSERT INTO derby5531_t2 VALUES('a')");
+ rs = s.executeQuery("select * from derby5531_t2 order by x");
+ JDBC.assertFullResultSet(rs,
+ new String[][] {{"a"}, {null}, {null}});
+ s.executeUpdate("DROP TABLE derby5531_t2");
+}
+
/**
* Test order by with English collation
*
@@ -1363,6 +1397,8 @@ public void testMissingCollatorSupport()
suite.addTest(new CleanDatabaseTestSetup(
new CollationTest("testDefaultCollation")));
suite.addTest(collatedSuite("en", false, "testEnglishCollation"));
+ suite.addTest(collatedSuite("en", true, "testNullColumnInInsert"));
+ suite.addTest(collatedSuite("en", false, "testNullColumnInInsert"));
// Only add tests for other locales if they are in fact supported
// by the jvm.