Issue Details (XML | Word | Printable)

Key: DERBY-3458
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Stephan van Loendersloot
Reporter: Stephan van Loendersloot
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

dblook fails on TERRITORY_BASED databases

Created: 23/Feb/08 07:24 PM   Updated: 25/Apr/08 04:15 PM
Return to search
Component/s: Tools
Affects Version/s: 10.3.2.1
Fix Version/s: 10.3.3.0, 10.4.1.3

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works DERBY-3458_patch_1.stat 2008-02-25 09:32 PM Stephan van Loendersloot 0.3 kB
Text File Licensed for inclusion in ASF works DERBY-3458_patch_1.txt 2008-02-25 09:32 PM Stephan van Loendersloot 6 kB
File Licensed for inclusion in ASF works DERBY-3458_patch_2.stat 2008-02-25 11:28 PM Stephan van Loendersloot 0.5 kB
Text File Licensed for inclusion in ASF works DERBY-3458_patch_2.txt 2008-02-25 11:28 PM Stephan van Loendersloot 79 kB
File Licensed for inclusion in ASF works DERBY-3458_patch_3.stat 2008-02-26 11:45 PM Stephan van Loendersloot 2 kB
Text File Licensed for inclusion in ASF works DERBY-3458_patch_3.txt 2008-02-26 11:45 PM Stephan van Loendersloot 1 kB
Text File Licensed for inclusion in ASF works DERBY-3458_patch_3_function_tests.txt 2008-02-26 11:45 PM Stephan van Loendersloot 112 kB
File Licensed for inclusion in ASF works DERBY-3458_patch_4.stat 2008-03-04 06:42 AM Stephan van Loendersloot 2 kB
Text File Licensed for inclusion in ASF works DERBY-3458_patch_4.txt 2008-03-04 06:42 AM Stephan van Loendersloot 1 kB
Text File Licensed for inclusion in ASF works DERBY-3458_patch_4_function_tests.txt 2008-03-04 06:42 AM Stephan van Loendersloot 136 kB

Resolution Date: 09/Mar/08 05:04 PM


 Description  « Hide
I've created small patches for myself by replacing all related queries in the 'tools' section with CASTs to CHARs and VARCHARs and would like to contribute these to the community in case anyone else can confirm this is a bug.

A small test case to reproduce the problem is provided below, the version of Derby that provides the stacktrace is 10.3.2.1.


Regards,


Stephan van Loendersloot.




Reproduction steps:

---------- 1: create_territory_db.sql ----------

CONNECT 'jdbc:derby://localhost/dutch;user=dutch;password=dutch;create=true;territory=nl_NL;collation=TERRITORY_BASED';

AUTOCOMMIT OFF;

CREATE TABLE AIRLINES
 (
    AIRLINE CHAR(2) NOT NULL ,
    AIRLINE_FULL VARCHAR(24),
    BASIC_RATE DOUBLE PRECISION,
    DISTANCE_DISCOUNT DOUBLE PRECISION,
    BUSINESS_LEVEL_FACTOR DOUBLE PRECISION,
    FIRSTCLASS_LEVEL_FACTOR DOUBLE PRECISION,
    ECONOMY_SEATS INTEGER,
    BUSINESS_SEATS INTEGER,
    FIRSTCLASS_SEATS INTEGER
 );

COMMIT;


DISCONNECT;
EXIT;

---------- 2: use dbloook ----------

dblook -d "jdbc:derby://localhost/dutch;user=dutch;password=dutch" -o dutch.sql

---------- 3: stacktrace ----------

java.sql.SQLSyntaxErrorException: Comparisons between 'CHAR (UCS_BASIC)' and 'CHAR (TERRITORY_BASED)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. select tablename from sys.systables where CAST(tablename as VARCHAR(128)) = 'T1')
  at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
  at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
  at org.apache.derby.client.am.Statement.executeQuery(Unknown Source)
  at org.apache.derby.tools.dblook.prepForDump(Unknown Source)
  at org.apache.derby.tools.dblook.go(Unknown Source)
  at org.apache.derby.tools.dblook.<init>(Unknown Source)
  at org.apache.derby.tools.dblook.main(Unknown Source)
Caused by: org.apache.derby.client.am.SqlException: Comparisons between 'CHAR (UCS_BASIC)' and 'CHAR (TERRITORY_BASED)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. select tablename from sys.systables where CAST(tablename as VARCHAR(128)) = 'T1')
  at org.apache.derby.client.am.Statement.completeSqlca(Unknown Source)
  at org.apache.derby.client.net.NetStatementReply.parsePrepareError(Unknown Source)
  at org.apache.derby.client.net.NetStatementReply.parsePRPSQLSTTreply(Unknown Source)
  at org.apache.derby.client.net.NetStatementReply.readPrepareDescribeOutput(Unknown Source)
  at org.apache.derby.client.net.StatementReply.readPrepareDescribeOutput(Unknown Source)
  at org.apache.derby.client.net.NetStatement.readPrepareDescribeOutput_(Unknown Source)
  at org.apache.derby.client.am.Statement.readPrepareDescribeOutput(Unknown Source)
  at org.apache.derby.client.am.Statement.flowExecute(Unknown Source)
  at org.apache.derby.client.am.Statement.executeQueryX(Unknown Source)
  ... 5 more
-- **--> DEBUG: Comparisons between 'CHAR (UCS_BASIC)' and 'CHAR (TERRITORY_BASED)' are not supported. Types must be comparable. String types must also have matching collation. If collation does not match, a possible solution is to cast operands to force them to the default collation (e.g. select tablename from sys.systables where CAST(tablename as VARCHAR(128)) = 'T1')

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
ASF #634037 Wed Mar 05 21:25:53 UTC 2008 mamta DERBY-3458

Patch submitted by Stephan van Loendersloot. dblook should set the current schema to be
a system schema so that collation of system schema (UCS_BASIC) gets used when dealing
with queries using system table columns and character constants. Stephan has also
provided comprehensive test for the dblook code change.
Files Changed
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory_app.properties
MODIFY /db/derby/code/trunk/java/tools/org/apache/derby/tools/dblook.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_sed.properties
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net_territory.out
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory.java
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net.java
ADD /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net_territory.out

Repository Revision Date User Message
ASF #635588 Mon Mar 10 16:19:23 UTC 2008 mamta Merging revision 634037 into 10.3 codeline fore DERBY-3458. The commit comments for
634037 were as follows

Patch submitted by Stephan van Loendersloot. dblook should set the current schema to be
a system schema so that collation of system schema (UCS_BASIC) gets used when dealing
with queries using system table columns and character constants. Stephan has also
provided comprehensive test for the dblook code change.
Files Changed
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory_app.properties (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory_app.properties)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/dblook_test_territory.out)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory.java (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory.java)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net_territory.out (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/dblook_test_net_territory.out)
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbynetmats.runall
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientRemote.exclude
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetClientUseprocess.exclude
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net.java
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net_territory.out (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/dblook_test_net_territory.out)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_app.properties)
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory.java (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/dblook_test_net_territory.java)
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/j9derbynetmats.runall
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/derbynet/NetHarnessJavaTest.java
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/derbytools.runall
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test.java
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetRemote.exclude
MODIFY /db/derby/code/branches/10.3/java/tools/org/apache/derby/tools/dblook.java
ADD /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_sed.properties (from /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/tools/dblook_test_territory_sed.properties)
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/suites/DerbyNetUseprocess.exclude