[ https://issues.apache.org/jira/browse/DERBY-2599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12497546
]
A B commented on DERBY-2599:
----------------------------
Hi Mamta, quick question on the latest patch.
The aggregate patch includes the following diff in ConcatenationOperatorNode:
+ if (rightOperand.getTypeId().isStringTypeId())
+ {//collation of ? operand should be same as the other operand
+ leftOperand.getTypeServices().setCollationDerivation(
+ rightOperand.getTypeServices().getCollationDerivation());
+ leftOperand.getTypeServices().setCollationType(
+ rightOperand.getTypeServices().getCollationType());
+ }
The collation wiki page says the following under "Collation Determination":
8) JDBC parameters (ie. ?) where the type of the parameter is a character
type will have the same collation as of the character set of the schema
where the statement is prepared. The collation derivation will be
implicit.
Is there a mismatch between the code and the wiki page?
I tried to write a sample case to demonstrate the difference but it looks like Derby always
sets the result of a concatenation operator to LONG VARCHAR if one operand is a char type
and the other is a parameter (that's the behavior I saw with my examples, anyways; maybe I'm
missing something). Since LONG VARCHARs are not comparable, that preempts any collation behavior
that I was trying to test. But I thought I'd post the question anyways, in case there's something
here that should be changed (perhaps just the wiki page?).
Apologies if I'm overlooking something obvious...
> 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, DERBY2599_Set_collation_for_aggregates_v1_diff.txt,
DERBY2599_Set_collation_for_aggregates_v1_stat.txt, DERBY2599_Set_collation_for_aggregates_v1_stat.txt,
DERBY2599_Set_collation_for_Max_Min_v1_diff.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.
|