Derby
  1. Derby
  2. DERBY-6009

Need stricter checking of ORDER BY clause in VALUES expressions

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.2.1.6, 10.2.2.0, 10.3.1.4, 10.3.2.1, 10.3.3.0, 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0, 10.6.1.0, 10.6.2.1, 10.7.1.1, 10.8.1.2, 10.8.2.2, 10.9.1.0
    • Fix Version/s: 10.10.1.1
    • Component/s: SQL
    • Issue & fix info:
      Repro attached

      Description

      We only support column numbers in ORDER BY clauses in VALUES expression, as seen by this error message:

      ij> values 1,2 order by 1+2;
      ERROR 42878: The ORDER BY clause of a SELECT UNION statement only supports unqualified column references and column position numbers. Other expressions are not currently supported. (errorCode = 30000)

      However, the checks let some unsupported expressions through and produce strange results. For example:

      ij> values 1 order by 1+2;
      1 |2
      -----------------------
      1 |3

      1 row selected

      It should probably have raised the same exception as the first query. And if not, the result should only have had one column.

      And the next example should probably have raised a syntax error too, instead of a NullPointerException:

      ij> values 1 order by int(1);
      ERROR XJ001: Java exception: ': java.lang.NullPointerException'. (errorCode = 0)

      1. derby-6009.diff
        9 kB
        Dag H. Wanvik
      2. derby-6009.stat
        0.5 kB
        Dag H. Wanvik
      3. derby-6009b.diff
        9 kB
        Dag H. Wanvik
      4. derby-6009b.stat
        0.5 kB
        Dag H. Wanvik
      5. derby-6009c.diff
        9 kB
        Dag H. Wanvik
      6. derby-6009c.stat
        0.5 kB
        Dag H. Wanvik

        Issue Links

          Activity

          Knut Anders Hatlen created issue -
          Bryan Pendleton made changes -
          Field Original Value New Value
          Summary Need stricter cheking of ORDER BY clause in VALUES expressions Need stricter checking of ORDER BY clause in VALUES expressions
          Dag H. Wanvik made changes -
          Attachment derby-6009.diff [ 12562446 ]
          Attachment derby-6009.stat [ 12562447 ]
          Dag H. Wanvik made changes -
          Attachment derby-6009b.diff [ 12562701 ]
          Attachment derby-6009b.stat [ 12562702 ]
          Dag H. Wanvik made changes -
          Assignee Dag H. Wanvik [ dagw ]
          Dag H. Wanvik made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Dag H. Wanvik made changes -
          Link This issue is related to DERBY-6027 [ DERBY-6027 ]
          Dag H. Wanvik made changes -
          Issue & fix info Repro attached [ 10424 ] Patch Available,Repro attached [ 10102, 10424 ]
          Dag H. Wanvik made changes -
          Attachment derby-6009c.diff [ 12563024 ]
          Attachment derby-6009c.stat [ 12563025 ]
          Dag H. Wanvik made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Issue & fix info Patch Available,Repro attached [ 10102, 10424 ] Repro attached [ 10424 ]
          Fix Version/s 10.10.0.0 [ 12321550 ]
          Resolution Fixed [ 1 ]
          Dag H. Wanvik made changes -
          Affects Version/s 10.8.2.2 [ 12317968 ]
          Affects Version/s 10.8.1.2 [ 12316362 ]
          Affects Version/s 10.7.1.1 [ 12315564 ]
          Affects Version/s 10.6.2.1 [ 12315343 ]
          Affects Version/s 10.6.1.0 [ 12313727 ]
          Affects Version/s 10.5.3.0 [ 12314117 ]
          Affects Version/s 10.5.2.0 [ 12314116 ]
          Affects Version/s 10.5.1.1 [ 12313771 ]
          Affects Version/s 10.4.2.0 [ 12313345 ]
          Affects Version/s 10.4.1.3 [ 12313111 ]
          Affects Version/s 10.3.3.0 [ 12313142 ]
          Affects Version/s 10.3.2.1 [ 12312876 ]
          Affects Version/s 10.3.1.4 [ 12312590 ]
          Affects Version/s 10.2.2.0 [ 12312027 ]
          Affects Version/s 10.2.1.6 [ 11187 ]
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 12741321 ] Default workflow, editable Closed status [ 12802878 ]
          Kathey Marsden made changes -
          Labels derby_backport_reject_10_9

            People

            • Assignee:
              Dag H. Wanvik
              Reporter:
              Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development