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

Single character does not match high value unicode character with collation TERRITORY_BASED

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.4.1.3
    • 10.3.2.1, 10.4.1.3
    • SQL
    • None
    • Release Note Needed

    Description

      With TERRITORY_BASED collation '_' does not match the character \uFA2D. It is the same for english or norwegian. FOR collation UCS_BASIC it matches fine. Could you tell me if this is a bug?
      Here is a program to reproduce.

      import java.sql.*;

      public class HighCharacter {

      public static void main(String args[]) throws Exception

      { System.out.println("\n Territory no_NO"); Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); Connection conn = DriverManager.getConnection("jdbc:derby:nordb;create=true;territory=no_NO;collation=TERRITORY_BASED"); testLikeWithHighestValidCharacter(conn); conn.close(); System.out.println("\n Territory en_US"); conn = DriverManager.getConnection("jdbc:derby:endb;create=true;territory=en_US;collation=TERRITORY_BASED"); testLikeWithHighestValidCharacter(conn); conn.close(); System.out.println("\n Collation USC_BASIC"); conn = DriverManager.getConnection("jdbc:derby:basicdb;create=true"); testLikeWithHighestValidCharacter(conn); }

      public static void testLikeWithHighestValidCharacter(Connection conn) throws SQLException {
      Statement stmt = conn.createStatement();
      try

      { stmt.executeUpdate("drop table t1"); }

      catch (SQLException se)

      {// drop failure ok. }

      stmt.executeUpdate("create table t1(c11 int)");
      stmt.executeUpdate("insert into t1 values 1");

      // \uFA2D - the highest valid character according to
      // Character.isDefined() of JDK 1.4;
      PreparedStatement ps =
      conn.prepareStatement("select 1 from t1 where '\uFA2D' like ?");
      String[] match =

      { "%", "_", "\uFA2D" }

      ;

      for (int i = 0; i < match.length; i++)

      { System.out.println("select 1 from t1 where '\\uFA2D' like " + match[i]); ps.setString(1, match[i]); ResultSet rs = ps.executeQuery(); if( rs.next() && rs.getString(1).equals("1")) System.out.println("PASS"); else System.out.println("FAIL: no match"); rs.close(); }

      }
      }

      Mamta made some comments on this issue in the following thread:

      http://www.nabble.com/Single-character-does-not-match-high-value-unicode-character-with-collation-TERRITORY_BASED.-Is-this-a-bug-tf4118767.html

      Attachments

        1. DERBY2967_Oct11_07_diff.txt
          33 kB
          Mamta A. Satoor
        2. DERBY2967_Oct11_07_stat.txt
          0.9 kB
          Mamta A. Satoor
        3. DERBY2967_offset_based_diff_Oct02_07.txt
          46 kB
          Mamta A. Satoor
        4. DERBY2967_offset_based_stat_Oct02_07.txt
          0.8 kB
          Mamta A. Satoor
        5. fullcoll.out
          185 kB
          Katherine Marsden
        6. patch2_setOffset_fullcoll.out
          1.54 MB
          Katherine Marsden
        7. patch2_with_setOffset_diff_Sep2007.txt
          31 kB
          Mamta A. Satoor
        8. patch2_with_setOffset_stat_Sep2007.txt
          0.5 kB
          Mamta A. Satoor
        9. releaseNote.html
          2 kB
          Katherine Marsden
        10. releaseNote.html
          2 kB
          Katherine Marsden
        11. step1_iteratorbased_Sep1507_diff.txt
          26 kB
          Mamta A. Satoor
        12. step1_iteratorbased_Sep1507_stat.txt
          0.3 kB
          Mamta A. Satoor
        13. temp_diff.txt
          26 kB
          Mamta A. Satoor
        14. temp_stat.txt
          0.3 kB
          Mamta A. Satoor
        15. TestFrench.java
          3 kB
          Katherine Marsden
        16. TestNorway.java
          3 kB
          Katherine Marsden

        Issue Links

          Activity

            People

              mamtas Mamta A. Satoor
              kmarsden Katherine Marsden
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: