[ 
https://issues.apache.org/jira/browse/DERBY-2599?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mamta A. Satoor updated DERBY-2599:
-----------------------------------

    Attachment: DERBY2599_correct_collation_for_cast_v1_stat.txt
                DERBY2599_correct_collation_for_cast_v1_diff.txt

The attached patch DERBY2599_correct_collation_for_cast_v1_diff.txt ensures 
that when an operand is CASTed to string datatype, the result type will take 
the collation of the current schema. So, if current schema is user schema for a 
database with territory based collation, then a comparison between a persistent 
character column from system table and a constant character string will fail 
because persistent character column from system table will have the collation 
of UCS_BASIC but the constant character string will pick up it's collation from 
current schema which is user schema and hence the collation will be territory 
based. Since the 2 collations don't match, we will get a compilation error for 
the query. To get around this, a user can rewrite the query to CAST persistent 
character column from system table to one of the character types and that 
resultant character type will pickup it's collation from current schema, so now 
both the operands will have collation of territory based and the query will 
execute without collation mismatch failure.

I will go ahead and commit this patch in next few minutes. If any feedback, 
please feel free to share.

> Set correct collation type and derivation on DataTypeDescriptor(DTD).
> ---------------------------------------------------------------------
>
>                 Key: DERBY-2599
>                 URL: https://issues.apache.org/jira/browse/DERBY-2599
>             Project: Derby
>          Issue Type: New Feature
>          Components: SQL
>    Affects Versions: 10.3.0.0
>            Reporter: Mamta A. Satoor
>         Assigned To: Mamta A. Satoor
>         Attachments: DERBY2599_collationType_default_UCS_BASIC_v1_diff.txt, 
> DERBY2599_collationType_default_UCS_BASIC_v1_stat.txt, 
> DERBY2599_correct_collation_for_cast_v1_diff.txt, 
> DERBY2599_correct_collation_for_cast_v1_stat.txt, 
> DERBY2599_IntermediatePatch_v1_diff.txt, 
> DERBY2599_IntermediatePatch_v1_stat.txt
>
>
> DTD has TypeDescriptorImpl in it which has 2 new fields, namely, 
> collationType and collationDerivation. These 2 fields are available for all 
> different types of DTDs but only apply to character types. The other 
> datatypes should ignore these 2 fields.
> This Jira is a placeholder for loading the correct values into collationType 
> and collationDerivation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to