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
Stephan van Loendersloot made changes - 25/Feb/08 09:21 PM
Field Original Value New Value
Assignee Stephan van Loendersloot [ whistle ]
Stephan van Loendersloot made changes - 25/Feb/08 09:32 PM
Attachment DERBY-3458_patch_1.stat [ 12376447 ]
Attachment DERBY-3458_patch_1.txt [ 12376446 ]
Stephan van Loendersloot made changes - 25/Feb/08 09:35 PM
Derby Info [Patch Available]
Stephan van Loendersloot made changes - 25/Feb/08 11:28 PM
Attachment DERBY-3458_patch_2.stat [ 12376457 ]
Attachment DERBY-3458_patch_2.txt [ 12376456 ]
Stephan van Loendersloot made changes - 26/Feb/08 11:45 PM
Attachment DERBY-3458_patch_3.stat [ 12376570 ]
Attachment DERBY-3458_patch_3_function_tests.txt [ 12376569 ]
Attachment DERBY-3458_patch_3.txt [ 12376568 ]
Stephan van Loendersloot made changes - 27/Feb/08 12:26 PM
Derby Info [Patch Available]
Stephan van Loendersloot made changes - 04/Mar/08 06:42 AM
Attachment DERBY-3458_patch_4.stat [ 12377040 ]
Attachment DERBY-3458_patch_4_function_tests.txt [ 12377039 ]
Attachment DERBY-3458_patch_4.txt [ 12377038 ]
Stephan van Loendersloot made changes - 04/Mar/08 06:42 AM
Derby Info [Patch Available]
Dyre Tjeldvoll made changes - 06/Mar/08 09:54 AM
Derby Info [Patch Available]
Stephan van Loendersloot made changes - 09/Mar/08 05:04 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Stephan van Loendersloot made changes - 09/Mar/08 05:06 PM
Status Resolved [ 5 ] Closed [ 6 ]
Kathey Marsden made changes - 25/Apr/08 04:15 PM
Fix Version/s 10.3.2.2 [ 12312885 ]