Derby
  1. Derby
  2. DERBY-2962

Change functional tests to use casts for System table queries to avoid conversion errors when run with TERRITORY_BASED collation

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.4.1.3
    • Fix Version/s: 10.4.1.3
    • Component/s: Test
    • Labels:
      None

      Description

      Many of the tests use system table queries which fail when run against a database with TERRITORY_BASED collation with exceptions like:
      Caused by: org.apache.derby.client.am.SqlException: Comparisons between 'VARCHAR' and 'CHAR' are not supported.
      and can be seen when running lang/FullCollationTests.java

      It would be good to change the tests to use casts so that the queries succeed and the tests can complete.

        Activity

        Hide
        Kathey Marsden added a comment -

        I changed the tests that run with Suites.All (FullCollationTests) but not derbyall since we are not setup to test that except by checking out all the *app.property files.

        Show
        Kathey Marsden added a comment - I changed the tests that run with Suites.All (FullCollationTests) but not derbyall since we are not setup to test that except by checking out all the *app.property files.
        Hide
        John H. Embretsen added a comment -

        I observed that the change to miscerrors.sql in revision 558801 are causing test failures in junit suites in some environments, see for example
        http://dbtg.thresher.com/derby/test/Daily/jvm1.5/testing/Limited/testSummary-561847.html

        miscerrors(org.apache.derbyTesting.functionTests.tests.lang.LangScripts)junit.framework.ComparisonFailure: Output at line 69 expected:<...where CAST(SQL_TEXT [AS LONG VARCHAR) LIKE '%932432%' ] ...> but was:<...where CAST(SQL_TEXT [ AS LONG VARCHAR) LIKE '%932432%'] ...>

        I think, from reading logs from nightly regression tests and my own tests, that the order of the two output rows from the statement

        ij> select SQL_TEXT from syscs_diag.statement_cache where CAST(SQL_TEXT AS LONG VARCHAR) LIKE '%932432%';

        varies between JVM versions (e.g. Sun JVM 1.6 has correct order according to the master file, while JVM versions 1.4 and 1.5 have the opposite order), hence causing the failure.

        Kathey, was it intentional to include an extra space in the above mentioned statement (between "TEXT" and "AS")?
        I think if the second space is removed, the result will contain one row instead of two, and we won't see this diff any longer...

        Show
        John H. Embretsen added a comment - I observed that the change to miscerrors.sql in revision 558801 are causing test failures in junit suites in some environments, see for example http://dbtg.thresher.com/derby/test/Daily/jvm1.5/testing/Limited/testSummary-561847.html miscerrors(org.apache.derbyTesting.functionTests.tests.lang.LangScripts)junit.framework.ComparisonFailure: Output at line 69 expected:<...where CAST(SQL_TEXT [AS LONG VARCHAR) LIKE '%932432%' ] ...> but was:<...where CAST(SQL_TEXT [ AS LONG VARCHAR) LIKE '%932432%'] ...> I think, from reading logs from nightly regression tests and my own tests, that the order of the two output rows from the statement ij> select SQL_TEXT from syscs_diag.statement_cache where CAST(SQL_TEXT AS LONG VARCHAR) LIKE '%932432%'; varies between JVM versions (e.g. Sun JVM 1.6 has correct order according to the master file, while JVM versions 1.4 and 1.5 have the opposite order), hence causing the failure. Kathey, was it intentional to include an extra space in the above mentioned statement (between "TEXT" and "AS")? I think if the second space is removed, the result will contain one row instead of two, and we won't see this diff any longer...
        Hide
        Kathey Marsden added a comment -

        I posted a patch a while back and would most appreciate if you could try
        it and I will check it in.
        http://www.nabble.com/lang.LangScripts-failure-tf4135897.html#a11810906

        The test does not fail in my environment so I cannot test it.

        Kathey

        Show
        Kathey Marsden added a comment - I posted a patch a while back and would most appreciate if you could try it and I will check it in. http://www.nabble.com/lang.LangScripts-failure-tf4135897.html#a11810906 The test does not fail in my environment so I cannot test it. Kathey
        Hide
        John H. Embretsen added a comment -

        I have tested the patch and have verified that the test succeeds with the patch, and fails without it. Feel free to commit

        Show
        John H. Embretsen added a comment - I have tested the patch and have verified that the test succeeds with the patch, and fails without it. Feel free to commit

          People

          • Assignee:
            Kathey Marsden
            Reporter:
            Kathey Marsden
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development