Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3181

isNullable on ResultSetMetaData from DatabaseMetaData.getBestRowIdentifier values are opposite when there is no rows in ResultSet vs. when there is a row.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 10.4.1.3
    • Fix Version/s: 10.13.1.0
    • Component/s: JDBC
    • Urgency:
      Normal
    • Issue & fix info:
      Newcomer, Repro attached

      Description

      With code like the following:

      DatabaseMetaData dmd = conn.getMetaData();
      ResultSet rs = dmd.getBestRowIdentifier(null,"APP","a",3,true);
      ResultSetMetaData rsmd = rs.getMetaData();
      int actualCols = rsmd.getColumnCount();
      for (int i = 0; i < actualCols; i++)

      { System.out.print("getColumnName: " + rsmd.getColumnName(i+1) + ", isNullable: "); System.out.println(rsmd.isNullable(i+1)); }

      The printed values for isNullable returned are opposite of what they are when the getBestRowIdentifier call looks like this:
      ResultSet rs = dmd.getBestRowIdentifier(null,"APP","a",1,true);

      In the latter case, the values are:
      getColumnName: SCOPE, isNullable: 0
      getColumnName: COLUMN_NAME, isNullable: 1
      getColumnName: DATA_TYPE, isNullable: 0
      getColumnName: TYPE_NAME, isNullable: 1
      getColumnName: COLUMN_SIZE, isNullable: 0
      getColumnName: BUFFER_LENGTH, isNullable: 0
      getColumnName: DECIMAL_DIGITS, isNullable: 0
      getColumnName: PSEUDO_COLUMN, isNullable: 0

      In the first case, the values are:
      getColumnName: SCOPE, isNullable: 1
      getColumnName: COLUMN_NAME, isNullable: 0
      getColumnName: DATA_TYPE, isNullable: 1
      getColumnName: TYPE_NAME, isNullable: 1
      getColumnName: COLUMN_SIZE, isNullable: 1
      getColumnName: BUFFER_LENGTH, isNullable: 1
      getColumnName: DECIMAL_DIGITS, isNullable: 1
      getColumnName: PSEUDO_COLUMN, isNullable: 1

      The isNullable value should be stable.
      It's probably worthwhile verifying what the value should be in the first place.

        Attachments

        1. deleteQuery.diff
          1 kB
          Danoja Dias
        2. Derby3181.diff
          3 kB
          Danoja Dias
        3. Derby-3181.diff
          0.6 kB
          Danoja Dias
        4. repro.java
          5 kB
          Myrna van Lunteren
        5. testChange.diff
          1 kB
          Bryan Pendleton

          Issue Links

            Activity

              People

              • Assignee:
                Dnj Danoja Dias
                Reporter:
                myrna Myrna van Lunteren
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: