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

LIKE does not match empty strings when used with a prepared statement

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.3.1.4
    • Fix Version/s: 10.2.2.0, 10.3.1.4
    • Component/s: JDBC, SQL
    • Labels:
      None
    • Urgency:
      Normal

      Description

      LIKE should give true for two 0-length strings. See SQL 2003 Ch. 8.5
      General Rules 3)c)i)

      The query SELECT * FROM t WHERE v like ''

      appears to give me all rows where v is an empty
      string, as expected.

      But a prepared statement

      SELECT * FROM t WHERE v like ?, with setString(1, "")

      always returns an empty result set. See attached repro for the full example.

        Attachments

        1. vti.java
          2 kB
          Dyre Tjeldvoll
        2. DERBY-1231.diff
          1 kB
          Bernt Johnsen
        3. DERBY-1231-v2.diff
          2 kB
          Bernt Johnsen
        4. DERBY-1231-v3.diff
          2 kB
          Bernt Johnsen

          Issue Links

            Activity

              People

              • Assignee:
                bernt Bernt Johnsen
                Reporter:
                dyret Dyre Tjeldvoll
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: