db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1399306 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/types/ testing/org/apache/derbyTesting/functionTests/tests/lang/
Date Wed, 17 Oct 2012 15:25:13 GMT
Author: rhillegas
Date: Wed Oct 17 15:25:12 2012
New Revision: 1399306

URL: http://svn.apache.org/viewvc?rev=1399306&view=rev
Log:
DERBY-5918: Allow BOOLEAN columns in CREATE TABLE ... AS SELECT statements.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CreateTableFromQueryTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java?rev=1399306&r1=1399305&r2=1399306&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java Wed
Oct 17 15:25:12 2012
@@ -1812,9 +1812,6 @@ public final class DataTypeDescriptor im
      *
      * Three examples are:
      *
-     *  BOOLEAN: A user can select boolean columns from system tables, but
-     *   s/he is not allowed to create such a column him/herself.
-     *
      *  JAVA_OBJECT: A user can select columns of various java object types
      *   from system tables, but s/he is not allowed to create such a column
      *   him/herself.
@@ -1831,8 +1828,6 @@ public final class DataTypeDescriptor im
     {
         switch (typeId.getJDBCTypeId())
         {
-            case Types.BOOLEAN:
-                return false;
             case Types.JAVA_OBJECT:
             	return getTypeId().getBaseTypeId().isAnsiUDT();
             case Types.DECIMAL:

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java?rev=1399306&r1=1399305&r2=1399306&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java
Wed Oct 17 15:25:12 2012
@@ -1893,6 +1893,31 @@ public class BooleanValuesTest  extends 
         rs.close();
     }
 
+    /**
+     * Verify that you can use CREATE TABLE AS SELECT to create
+     * empty tables with BOOLEAN columns.
+     */
+    public void test_5918() throws Exception
+    {
+        setAutoCommit(false);
+
+        Statement s = createStatement();
+        s.execute("create table derby5918_1(b boolean)");
+        s.execute("create table derby5918_2 as select * from derby5918_1 with no data");
+        s.executeUpdate("insert into derby5918_2 values ( true )");
+        
+        assertResults
+            (
+             getConnection(),
+             "select * from derby5918_2",
+             new String[][]
+             {
+                 { "true" },
+             },
+             false
+             );
+    }
+    
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // SQL ROUTINES

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CreateTableFromQueryTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CreateTableFromQueryTest.java?rev=1399306&r1=1399305&r2=1399306&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CreateTableFromQueryTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CreateTableFromQueryTest.java
Wed Oct 17 15:25:12 2012
@@ -262,10 +262,6 @@ public final class CreateTableFromQueryT
     {
         Statement stmt = createStatement();
 
-        // BOOLEAN
-        assertStatementError("42X71", stmt,
-            "create table t as select systemalias from sys.sysaliases with no data");
-
         // USER (Java Object)
         assertStatementError("42X71", stmt,
             "create table t as select aliasinfo from sys.sysaliases with no data");



Mime
View raw message