Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.6.1.0
    • Fix Version/s: 10.7.1.1
    • Component/s: SQL
    • Labels:
      None
    • Issue & fix info:
      Patch Available

      Description

      Allow tables to have boolean columns.

      1. derby-4716-04-aa-moreTests.diff
        12 kB
        Rick Hillegas
      2. derby-4716-03-aa-booleanDefaults.diff
        3 kB
        Rick Hillegas
      3. derby-4716-02-aa-indexOrder.diff
        3 kB
        Rick Hillegas
      4. derby-4716-01-ab-enableBooleanColumns.diff
        14 kB
        Rick Hillegas

        Issue Links

          Activity

          Hide
          Rick Hillegas added a comment -

          Attaching derby-4716-01-ab-enableBooleanColumns.diff. This is the first increment of enabling BOOLEAN-typed columns in tables. This patch supports the ability to declare BOOLEAN columns in CREATE TABLE statements and verifies that casting semantics are correct for INSERTs. Follow-on patches should address ALTER TABLE and index creation. Regression tests passed cleanly for me.

          One oddity which will have to be addressed in a follow-on patch is this:

          1) If you select from an unindexed BOOLEAN column, NULLs sort at the end, as they do for other Derby datatypes.

          2) But if you put an index on the BOOLEAN column, this causes NULLs to sort before other values.

          BOOLEAN-valued indexes should follow the sorting conventions of other datatypes. There should be no backward compatibility issues here because none of the system indexes carry BOOLEAN columns today.

          Touches the following files:

          -----------

          M java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj

          Allows BOOLEAN as a column data type. Removes scaffolding put in at the beginning of 10.7 development. That scaffolding added a parameter to the dataTypeDDL() production so that we could incrementally enable BOOLEAN in different parts of the syntax without enabling BOOLEAN wholesale everywhere. That parameter is now removed. As of this patch, BOOLEAN is allowed everywhere that the other system datatypes are allowed--provided that the database level is 10.7 or higher.

          -----------

          M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java

          Tests for INSERTing various datatypes into BOOLEAN columns.

          -----------

          M java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMetaDataJdbc30Test.java

          ParameterMetaData test for INSERTs into BOOLEAN-valued columns.

          -----------

          M java/testing/org/apache/derbyTesting/functionTests/master/db2Compatibility.out

          Canon change because BOOLEAN columns are supported now.

          Show
          Rick Hillegas added a comment - Attaching derby-4716-01-ab-enableBooleanColumns.diff. This is the first increment of enabling BOOLEAN-typed columns in tables. This patch supports the ability to declare BOOLEAN columns in CREATE TABLE statements and verifies that casting semantics are correct for INSERTs. Follow-on patches should address ALTER TABLE and index creation. Regression tests passed cleanly for me. One oddity which will have to be addressed in a follow-on patch is this: 1) If you select from an unindexed BOOLEAN column, NULLs sort at the end, as they do for other Derby datatypes. 2) But if you put an index on the BOOLEAN column, this causes NULLs to sort before other values. BOOLEAN-valued indexes should follow the sorting conventions of other datatypes. There should be no backward compatibility issues here because none of the system indexes carry BOOLEAN columns today. Touches the following files: ----------- M java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj Allows BOOLEAN as a column data type. Removes scaffolding put in at the beginning of 10.7 development. That scaffolding added a parameter to the dataTypeDDL() production so that we could incrementally enable BOOLEAN in different parts of the syntax without enabling BOOLEAN wholesale everywhere. That parameter is now removed. As of this patch, BOOLEAN is allowed everywhere that the other system datatypes are allowed--provided that the database level is 10.7 or higher. ----------- M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java Tests for INSERTing various datatypes into BOOLEAN columns. ----------- M java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMetaDataJdbc30Test.java ParameterMetaData test for INSERTs into BOOLEAN-valued columns. ----------- M java/testing/org/apache/derbyTesting/functionTests/master/db2Compatibility.out Canon change because BOOLEAN columns are supported now.
          Hide
          Rick Hillegas added a comment -

          Committed derby-4716-01-ab-enableBooleanColumns.diff at subversion revision 958565.

          Show
          Rick Hillegas added a comment - Committed derby-4716-01-ab-enableBooleanColumns.diff at subversion revision 958565.
          Hide
          Rick Hillegas added a comment -

          Attaching derby-4716-02-aa-indexOrder.diff. This corrects the sort order of null for indexed BOOLEANs, making that order agree with the sort order of unindexed BOOLEANs and other indexed types. I am running tests now.

          Touches the following files:

          ---------

          M java/engine/org/apache/derby/iapi/types/SQLBoolean.java

          There is a table of comments in both SQLBoolean.compare(DataValueDescriptor other) and NumberDataType.compare(DataValueDescriptor other). The final column in each table states the semantics of how the methods should behave. That final column agrees in both methods. However, the two comment blocks disagree on what actual return value enforces those semantics. The SQLBoolean values are the opposite of those in NumberDataValue both in the comments and in the subsequent implementation. I simply made the comments and implementation of SQLBoolean.compare(DataValueDescriptor other) agree with NumberDataType.compare(DataValueDescriptor other).

          ---------

          M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java

          Added a regression test case for this change.

          Show
          Rick Hillegas added a comment - Attaching derby-4716-02-aa-indexOrder.diff. This corrects the sort order of null for indexed BOOLEANs, making that order agree with the sort order of unindexed BOOLEANs and other indexed types. I am running tests now. Touches the following files: --------- M java/engine/org/apache/derby/iapi/types/SQLBoolean.java There is a table of comments in both SQLBoolean.compare(DataValueDescriptor other) and NumberDataType.compare(DataValueDescriptor other). The final column in each table states the semantics of how the methods should behave. That final column agrees in both methods. However, the two comment blocks disagree on what actual return value enforces those semantics. The SQLBoolean values are the opposite of those in NumberDataValue both in the comments and in the subsequent implementation. I simply made the comments and implementation of SQLBoolean.compare(DataValueDescriptor other) agree with NumberDataType.compare(DataValueDescriptor other). --------- M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java Added a regression test case for this change.
          Hide
          Rick Hillegas added a comment -

          Tests ran cleanly for me. Committed derby-4716-02-aa-indexOrder.diff at subversion revision 958610.

          Show
          Rick Hillegas added a comment - Tests ran cleanly for me. Committed derby-4716-02-aa-indexOrder.diff at subversion revision 958610.
          Hide
          Rick Hillegas added a comment -

          Attaching derby-4716-03-aa-booleanDefaults.diff. This patch adds BOOLEAN defaults to the CREATE/ALTER TABLE statements. I am running tests now.

          Touches the following files:

          ---------

          M java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java

          Allows the DEFAULT clause on BOOLEAN columns provided that the default value is a BOOLEAN literal.

          ---------

          M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java

          Adds tests for this improvement.

          Show
          Rick Hillegas added a comment - Attaching derby-4716-03-aa-booleanDefaults.diff. This patch adds BOOLEAN defaults to the CREATE/ALTER TABLE statements. I am running tests now. Touches the following files: --------- M java/engine/org/apache/derby/impl/sql/compile/ColumnDefinitionNode.java Allows the DEFAULT clause on BOOLEAN columns provided that the default value is a BOOLEAN literal. --------- M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java Adds tests for this improvement.
          Hide
          Rick Hillegas added a comment -

          Tests passed for me. Committed derby-4716-03-aa-booleanDefaults.diff at subversion revision 958677.

          Show
          Rick Hillegas added a comment - Tests passed for me. Committed derby-4716-03-aa-booleanDefaults.diff at subversion revision 958677.
          Hide
          Rick Hillegas added a comment -

          Attaching derby-4716-04-aa-moreTests.diff. This patch adds test cases verifying the basic functioning of:

          o ALTER TABLE

          o Generated BOOLEAN columns

          o Constraints on BOOLEAN columns

          o Triggers on BOOLEAN columns

          o Views on BOOLEAN columns

          Committed at subversion revision 960071.

          Touches the following file:

          M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java

          Show
          Rick Hillegas added a comment - Attaching derby-4716-04-aa-moreTests.diff. This patch adds test cases verifying the basic functioning of: o ALTER TABLE o Generated BOOLEAN columns o Constraints on BOOLEAN columns o Triggers on BOOLEAN columns o Views on BOOLEAN columns Committed at subversion revision 960071. Touches the following file: M java/testing/org/apache/derbyTesting/functionTests/tests/lang/BooleanValuesTest.java

            People

            • Assignee:
              Rick Hillegas
              Reporter:
              Rick Hillegas
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development