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

Using RTRIM(LTRIM(col)) and group by col gives NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.1.3.1
    • 10.2.1.6
    • SQL
    • None
    • Windows 2000, Sun JDK 1.4.2_10
    • Normal

    Description

      When trying to execute a simple SQL Statement that includes both the RTRIM() and LTRIM() functions on a column in the SELECT clause and contains a GROUP BY clause on that column, the following Nullpointer Exception is thrown:
      ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
      This does NOT happen, if only RTRIM() OR LTRIM() is used, or if no GROUP BY clause is specified.

      This issue is quite urgent for us, as we don't see a workaround to achieve the desired results.

      Attached an example table schema and the affected SELECT Statement.
      --------------------------------------------
      CREATE TABLE t1 (
      c1 VARCHAR(10),
      c2 VARCHAR(10)
      );

      INSERT INTO t1 VALUES('a', 'b');
      INSERT INTO t1 VALUES('c', 'd');

      SELECT RTRIM(LTRIM(c1)),
      COUNT
      FROM t1
      GROUP BY c1;

      Attachments

        Activity

          People

            Unassigned Unassigned
            cschick Christopher Schick
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: