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 "Mamta A. Satoor (JIRA)" <ji...@apache.org> on 2007/07/06 11:12:04 UTC

[jira] Created: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
--------------------------------------------------------------------------------------------------------------------------------------------

                 Key: DERBY-2910
                 URL: https://issues.apache.org/jira/browse/DERBY-2910
             Project: Derby
          Issue Type: Bug
    Affects Versions: 10.3.1.1, 10.4.0.0
            Reporter: Mamta A. Satoor


Following query should run into error if run in a territory based database 
SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;

When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 

There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Commented: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510797 ] 

Daniel John Debrunner commented on DERBY-2910:
----------------------------------------------

It's a little unclear on this what problem is or  the resolution might be. 

Is the bug that collation is setup incorrectly such that this statement fails when it shouldn't?
SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME

or is that the statement should fail and it isn't?

If it's the latter, why should that statement fail?


> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.1.1, 10.4.0.0
>            Reporter: Mamta A. Satoor
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Resolved: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden resolved DERBY-2910.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 10.4.0.0
                   10.3.1.5

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>             Fix For: 10.3.1.5, 10.4.0.0
>
>         Attachments: derby-2910_diff.txt, derby-2910_diff.txt, derby-2910_stat.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Updated: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Mike Matrigali (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Matrigali updated DERBY-2910:
----------------------------------

    Component/s: SQL

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.1, 10.4.0.0
>            Reporter: Mamta A. Satoor
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Assigned: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden reassigned DERBY-2910:
-------------------------------------

    Assignee: Kathey Marsden

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Commented: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523136 ] 

Daniel John Debrunner commented on DERBY-2910:
----------------------------------------------

Comments in the code indicating why that collation was picked would be useful for future coders ...

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>         Attachments: derby-2910_diff.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Commented: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523167 ] 

Mamta A. Satoor commented on DERBY-2910:
----------------------------------------

Kathey, thanks for picking up this bug. Your approach seems logical, ie have internal CASTs pick up the current compilation schema's collation just as we do for explicit CASTs. I wonder if the SQL spec says anything at all for such implicit CASTs and their collation type. But from a user point of view, your approach surely makes sense to me.

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>         Attachments: derby-2910_diff.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Commented: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523268 ] 

Mamta A. Satoor commented on DERBY-2910:
----------------------------------------

Kathey, that sounds reasonable to me.

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>         Attachments: derby-2910_diff.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Commented: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523258 ] 

Kathey Marsden commented on DERBY-2910:
---------------------------------------

I am having trouble finding any explicit reference to the collation of implicit casts.  The SQL Spec in section 6.1.2 says of explicit casts:

"10) If TD is a fixed-length, variable-length, or large object character string, then TD shall not specify <collate
clause>. The declared type collation of the <cast specification> is the character set collation of the character
set of TD and its collation derivation is implicit."


I think that given no explicit rules for implicit casts, that they should follow the same rules as explicit casts. Does that sound reasonable?

Kathey
 



> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>         Attachments: derby-2910_diff.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Updated: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-2910:
----------------------------------

    Attachment: derby-2910_stat.txt
                derby-2910_diff.txt

Attached is a patch for this issue. I am currently running tests but am interested to know if I am on the right track since this is my first collation bug fix.  This change changes implicit casts in
SimpleStringOperatorNode, ConcatenationOperatorNode, and TernaryOperatorNode to use the current schema collation when doing an implicit cast.

I could not come up with a test case for TernaryOperatorNode as substr will not accept a date argument.  I changed the code anyway.  It may be that it is unreachable.





> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>         Attachments: derby-2910_diff.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Commented: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Daniel John Debrunner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523135 ] 

Daniel John Debrunner commented on DERBY-2910:
----------------------------------------------

FYI - on the test changes, instead of:

assertEquals(1,JDBC.assertDrainResults(rs));

you can use the rowCount version of assertDrainResults, i.e.

JDBC.assertDrainResults(rs, 1);

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>         Attachments: derby-2910_diff.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Commented: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12511170 ] 

Mamta A. Satoor commented on DERBY-2910:
----------------------------------------

I guess what I would like to discuss is what should be the collation of the resultant character string of UPPER when it's operand is not of type character string. Derby internally generate a CAST to generate the character string (following our rules for type conversions) for a case like UPPER(CURRENT_DATE) because UPPER works on character string type operand.

For instance in UPPER(CURRENT_USER), the operand CURRENT_USER is character string type with collation of UCS_BASIC and hence the result of UPPER has collation type of UCS_BASIC. But in UPPER(CURRENT_DATE), CURRENT_DATE is of date type and hence we internally generate a CAST node on date to generate character string type and that internal CAST always generates a character string of type UCS_BASIC collation. My question is is that the right thing to do? Should we have such internal CASTs (from non-character string type to character string types) pick up the collation of the current compilation schema?

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.1.1, 10.4.0.0
>            Reporter: Mamta A. Satoor
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Commented: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12523099 ] 

Kathey Marsden commented on DERBY-2910:
---------------------------------------

Mamta asked
>My question is is that the right thing to do? Should we have such internal CASTs (from non-character string type to >character string types) pick up the collation of the current compilation schema?

I think it should pick up the collation of the current compilation schema for implicit casts as it does for explicit casts.
Here is an exaple of a statement that I think should execute but currently does not because of the UCS_BASIC default.

ij> create table a (vc varchar(30));
0 rows inserted/updated/deleted
ij> insert into a values(CURRENT_DATE);
1 row inserted/updated/deleted

ij> select vc from a where vc = UPPER(CURRENT_DATE);
ERROR 42818: Comparisons between 'VARCHAR (TERRITORY_BASED)' and 'VARCHAR (UCS_BASIC)' 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))


This implicit cast is ok:
ij> select vc from a where vc = CURRENT_DATE;
VC
------------------------------
2007-08-27




> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Updated: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-2910:
----------------------------------

    Derby Info:   (was: [Patch Available])

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>         Attachments: derby-2910_diff.txt, derby-2910_diff.txt, derby-2910_stat.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Updated: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-2910:
----------------------------------

    Attachment: derby-2910_stat.txt
                derby-2910_diff.txt

Here is an updated patch with comments and test changes suggested by Dan.  I will commit this afternoon if I hear no objections.

Kathey


> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>         Attachments: derby-2910_diff.txt, derby-2910_diff.txt, derby-2910_stat.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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


[jira] Updated: (DERBY-2910) SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-2910:
----------------------------------

    Derby Info: [Patch Available]

> SimpleStringOperatorNode in it's bindExpression method generates a character string CAST if required but does not set the correct collation.
> --------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2910
>                 URL: https://issues.apache.org/jira/browse/DERBY-2910
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.0.0
>            Reporter: Mamta A. Satoor
>            Assignee: Kathey Marsden
>         Attachments: derby-2910_diff.txt, derby-2910_stat.txt
>
>
> Following query should run into error if run in a territory based database 
> SELECT TABLENAME FROM SYS.SYSTABLES WHERE UPPER(CURRENT_DATE) = TABLENAME;
> When a CAST node is generated on top of CURRENT_DATE to create a character string type, we do not set the collation of that character string type and hence it always ends up getting the default which is collation derivation IMPLICIT and collation type UCS_BASIC. That does not sound right. 
> There might be other places where we generate CAST node to create a character string type. We should check if the collation is set correctly for them.

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