[
https://issues.apache.org/jira/browse/DERBY-2909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511179
]
Daniel John Debrunner commented on DERBY-2909:
----------------------------------------------
I'm not sure what the last comment is trying to say. If we simplify the example
SQL to:
SELECT TRIM('E' from TABLENAME) from SYS.SYSTABLES
[because the issue seems to be the comparability of 'E' and TABLENAME, not
comparing the result of the TRIM to TABLENAME in the original SQL]
then I'm not sure what it means to say Derby is using UCS_BASIC collation. I
couldn't see anything in 6.29 that says any collation is used for TRIM.
> TernaryOperatorNode does not check the collation type of it's operands when
> implementing TRIM, LOCATE functions.
> ----------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-2909
> URL: https://issues.apache.org/jira/browse/DERBY-2909
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.3.1.1, 10.4.0.0
> Reporter: Mamta A. Satoor
>
> Queries like following should fail in a territory based database if the
> current schema is a user schema
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE LOCATE('LOOKFORME', TABLENAME) != 0;
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE TRIM('E' from TABLENAME) =
> TABLENAME;
> This is because the collation type of the first operand for both LOCATE and
> TRIM is territory based but the second parameter has collation of UCS_BASIC
> and hence such a comparison should not be allowed. In order to fix this, we
> need code like following in TernaryOperatorNode
> //Make sure that the string operands are comparable ie their collation
> //should be considered in deciding whether the string operands can be
> //compared with each other
> boolean cmp =
> leftOperand.getTypeServices().comparable(receiver.getTypeServices(),
> true,
> getClassFactory());
> if (!cmp) {
> throw StandardException.newException(SQLState.LANG_NOT_COMPARABLE,
> receiverType.getSQLTypeName(),
> leftCTI.getSQLTypeName()
> );
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.