db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bpendle...@apache.org
Subject svn commit: r1747486 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java
Date Thu, 09 Jun 2016 03:05:39 GMT
Author: bpendleton
Date: Thu Jun  9 03:05:39 2016
New Revision: 1747486

URL: http://svn.apache.org/viewvc?rev=1747486&view=rev
Log:
DERBY-6550: Bulk-insert causes identity columns to cycle when they shouldn't

This change was contributed by Danoja Dias (danojadias at gmail dot com)

Adds a new test case to verify that a bigint identity column correctly
refuses to cycle when the identity value reaches the maximum value.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java?rev=1747486&r1=1747485&r2=1747486&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/MergeStatementTest.java
Thu Jun  9 03:05:39 2016
@@ -39,6 +39,7 @@ import org.apache.derbyTesting.junit.Bas
 import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
 import org.apache.derbyTesting.junit.DatabasePropertyTestSetup;
 import org.apache.derbyTesting.junit.Decorator;
+import org.apache.derbyTesting.junit.JDBC;
 import org.apache.derbyTesting.junit.SupportFilesSetup;
 import org.apache.derbyTesting.junit.TestConfiguration;
 
@@ -9532,6 +9533,33 @@ public class MergeStatementTest extends
             dropTable("t2");
         }
     }
+
+    public void test_062_Derby6550() throws SQLException {
+        Statement s = createStatement();
+        
+        s.execute("create table t(a bigint generated always as identity " +
+                  "    ( start with 9223372036854775806 ),b int)");
+        s.execute("create function integerList()\n" +
+                "returns table(a int,b int,c int,d int)\n" +
+                "language java\n" +
+                "parameter style derby_jdbc_result_set\n" +
+                "no sql\n" +
+                "external name 'org.apache.derbyTesting.functionTests.tests.lang.MergeStatementTest.integerList_023'\n");
+
+        // this fails because bulk-insert isn't used and we go past the
+        // end of the identity column's range
+        assertStatementError("2200H", s,
+            "insert into t( b ) values ( 1 ), ( 2 ), ( 3 ), ( 4 ), ( 5 )" );
+
+        // inserting into an empty table from a table function uses bulk-insert
+        //
+        // this should fail just like the previous statement, but it succeeds
+        assertStatementError("2200H", s,
+            "insert into t( b ) select b from table( integerList() ) il");
+
+        JDBC.assertEmpty( s.executeQuery("select * from t") );
+
+    }
     
     ///////////////////////////////////////////////////////////////////////////////////
     //



Mime
View raw message