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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.3.1.4
    • 10.2.2.0, 10.3.1.4
    • JDBC, SQL
    • None
    • 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. DERBY-1231-v3.diff
          2 kB
          Bernt Johnsen
        2. DERBY-1231-v2.diff
          2 kB
          Bernt Johnsen
        3. DERBY-1231.diff
          1 kB
          Bernt Johnsen
        4. vti.java
          2 kB
          Dyre Tjeldvoll

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: