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

EXISTS returns NULL instead of FALSE

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1, 10.8.3.3, 10.9.2.2, 10.10.1.1
    • Fix Version/s: 10.10.2.0, 10.11.1.1
    • Component/s: SQL
    • Labels:
      None
    • Urgency:
      Normal
    • Issue & fix info:
      Repro attached
    • Bug behavior facts:
      Deviation from standard, Wrong query result

      Description

      The reference manual topic on Boolean expressions - http://db.apache.org/derby/docs/10.10/ref/rrefsqlj23075.html - says that EXISTS should return FALSE if the subquery returns no rows. In reality, it returns NULL:

      ij> create table t(x int);
      0 rows inserted/updated/deleted
      ij> values exists(select * from t);
      1


      NULL

      1 row selected

      SQL:2011, part 2, 8.10 <exists predicate> also says that FALSE is the correct result if the cardinality is 0.

        Attachments

        1. d6408-1a.diff
          12 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:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: