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

Scalar subquery erroneously rejected for not returning exactly one row

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.5.3.1, 10.6.1.0
    • Fix Version/s: 10.5.3.1, 10.6.1.0
    • Component/s: SQL
    • Labels:
      None
    • Issue & fix info:
      Repro attached

      Description

      This sequence of statements causes an error because the scalar sub-query supposedly doesn't return exactly one row, even though it does return exactly one row:

      ij> create table t (x int unique, y int);
      0 rows inserted/updated/deleted
      ij> insert into t values (1,2);
      1 row inserted/updated/deleted
      ij> select * from t where x > (values 1 union select y from t where 1=0);
      ERROR 21000: Scalar subquery is only allowed to return a single row.
      ij> values 1 union select y from t where 1=0;
      1
      -----------
      1

      1 row selected

      Before DERBY-4391, the problematic statement would have caused a NullPointerException.

        Attachments

        1. constantRestriction.diff
          0.6 kB
          Knut Anders Hatlen
        2. derby-4411-1a.diff
          3 kB
          Knut Anders Hatlen

          Issue Links

            Activity

              People

              • Assignee:
                knutanders Knut Anders Hatlen
                Reporter:
                knutanders Knut Anders Hatlen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: