You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Daniel John Debrunner <dj...@apache.org> on 2007/09/04 20:48:20 UTC

Collation derivation for UPPER etc. incorrect in wiki page?

Rule 5) in the collation wiki page says:
-------------------------------------------------------------------
5)Result character string types from UPPER, LOWER, TRIM(LTRIM, RTRIM), 
SUBSTR will have the same collation as their operand. This comes from 
SQL spec Section 6.29 <string value function> Syntax Rules 8, 8, 11d, 4 
respectively). The collation derivation will be implicit.
-------------------------------------------------------------------

http://wiki.apache.org/db-derby/BuiltInLanguageBasedOrderingDERBY-1478

I don't see where the last sentence comes from: "The collation 
derivation will be implicit.".

That doesn't seem to be correct, if the operand has collation explicit 
or none shouldn't that be carried through to the result of the character 
string function? The rules in 6.29 that are quoted by 5) above just say 
the type is the type of the operand which includes the derivation, 
right? I don't see anything in 6.29 about asserting implicit derivation.

I haven't looked at the code to see what is implemented, just wanted to 
raise this as a possible issue.

Dan.

Re: Collation derivation for UPPER etc. incorrect in wiki page?

Posted by Mamta Satoor <ms...@gmail.com>.
I looked at TernaryOperatorNode for TRIM, SUBSTR and we are correctly using
the collation derivation of the operand rather than always setting the
result's collation derivation to implicit. For UPPER and LOWER, I checked
SimpleStringOperatorNode and again, we are correctly using the collation
derivation of operand rather than always setting the result's collation
derivation to implicit.

I will go ahead and fix the wiki page.

thanks for catching this,
Mamta


On 9/4/07, Daniel John Debrunner <dj...@apache.org> wrote:
>
> Rule 5) in the collation wiki page says:
> -------------------------------------------------------------------
> 5)Result character string types from UPPER, LOWER, TRIM(LTRIM, RTRIM),
> SUBSTR will have the same collation as their operand. This comes from
> SQL spec Section 6.29 <string value function> Syntax Rules 8, 8, 11d, 4
> respectively). The collation derivation will be implicit.
> -------------------------------------------------------------------
>
> http://wiki.apache.org/db-derby/BuiltInLanguageBasedOrderingDERBY-1478
>
> I don't see where the last sentence comes from: "The collation
> derivation will be implicit.".
>
> That doesn't seem to be correct, if the operand has collation explicit
> or none shouldn't that be carried through to the result of the character
> string function? The rules in 6.29 that are quoted by 5) above just say
> the type is the type of the operand which includes the derivation,
> right? I don't see anything in 6.29 about asserting implicit derivation.
>
> I haven't looked at the code to see what is implemented, just wanted to
> raise this as a possible issue.
>
> Dan.
>

Re: Collation derivation for UPPER etc. incorrect in wiki page?

Posted by Mamta Satoor <ms...@gmail.com>.
Dan, I will look into what the code is doing.

thanks,
Mamta


On 9/4/07, Daniel John Debrunner <dj...@apache.org> wrote:
>
> Rule 5) in the collation wiki page says:
> -------------------------------------------------------------------
> 5)Result character string types from UPPER, LOWER, TRIM(LTRIM, RTRIM),
> SUBSTR will have the same collation as their operand. This comes from
> SQL spec Section 6.29 <string value function> Syntax Rules 8, 8, 11d, 4
> respectively). The collation derivation will be implicit.
> -------------------------------------------------------------------
>
> http://wiki.apache.org/db-derby/BuiltInLanguageBasedOrderingDERBY-1478
>
> I don't see where the last sentence comes from: "The collation
> derivation will be implicit.".
>
> That doesn't seem to be correct, if the operand has collation explicit
> or none shouldn't that be carried through to the result of the character
> string function? The rules in 6.29 that are quoted by 5) above just say
> the type is the type of the operand which includes the derivation,
> right? I don't see anything in 6.29 about asserting implicit derivation.
>
> I haven't looked at the code to see what is implemented, just wanted to
> raise this as a possible issue.
>
> Dan.
>