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 "Kathey Marsden (JIRA)" <ji...@apache.org> on 2007/07/19 17:03:06 UTC
[jira] Created: (DERBY-2956) With a collated database USER cannot
be used in query against user tables without cast
With a collated database USER cannot be used in query against user tables without cast
--------------------------------------------------------------------------------------
Key: DERBY-2956
URL: https://issues.apache.org/jira/browse/DERBY-2956
Project: Derby
Issue Type: Bug
Components: SQL
Affects Versions: 10.4.0.0
Reporter: Kathey Marsden
ij> create table staff (empname varchar(30));
0 rows inserted/updated/deleted
ij> insert into staff values('APP');
1 row inserted/updated/deleted
ij> insert into staff values('KATHEY');
1 row inserted/updated/deleted
ij> select * from staff where empname like USER;
ERROR 42ZA2: Operand of LIKE predicate with type VARCHAR(30) and collation TERRITORY_BASED is not compatable with LIKE p
attern operand with type VARCHAR(128) and collation UCS_BASIC.
ij>
Workaround is to use a cast
ij> select * from staff where empname like CAST(USER as VARCHAR(30));
EMPNAME
------------------------------
APP
1 row selected
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (DERBY-2956) With a collated database USER cannot
be used in query against user tables without cast
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden resolved DERBY-2956.
-----------------------------------
Resolution: Invalid
Mamta says this is expected behavour but it will mean that the Nist tests won't pass with a collated database.
> With a collated database USER cannot be used in query against user tables without cast
> --------------------------------------------------------------------------------------
>
> Key: DERBY-2956
> URL: https://issues.apache.org/jira/browse/DERBY-2956
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.0.0
> Reporter: Kathey Marsden
>
> ij> create table staff (empname varchar(30));
> 0 rows inserted/updated/deleted
> ij> insert into staff values('APP');
> 1 row inserted/updated/deleted
> ij> insert into staff values('KATHEY');
> 1 row inserted/updated/deleted
> ij> select * from staff where empname like USER;
> ERROR 42ZA2: Operand of LIKE predicate with type VARCHAR(30) and collation TERRITORY_BASED is not compatable with LIKE p
> attern operand with type VARCHAR(128) and collation UCS_BASIC.
> ij>
> Workaround is to use a cast
> ij> select * from staff where empname like CAST(USER as VARCHAR(30));
> EMPNAME
> ------------------------------
> APP
> 1 row selected
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (DERBY-2956) With a collated database USER cannot be
used in query against user tables without cast
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2956?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden closed DERBY-2956.
---------------------------------
> With a collated database USER cannot be used in query against user tables without cast
> --------------------------------------------------------------------------------------
>
> Key: DERBY-2956
> URL: https://issues.apache.org/jira/browse/DERBY-2956
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.0.0
> Reporter: Kathey Marsden
>
> ij> create table staff (empname varchar(30));
> 0 rows inserted/updated/deleted
> ij> insert into staff values('APP');
> 1 row inserted/updated/deleted
> ij> insert into staff values('KATHEY');
> 1 row inserted/updated/deleted
> ij> select * from staff where empname like USER;
> ERROR 42ZA2: Operand of LIKE predicate with type VARCHAR(30) and collation TERRITORY_BASED is not compatable with LIKE p
> attern operand with type VARCHAR(128) and collation UCS_BASIC.
> ij>
> Workaround is to use a cast
> ij> select * from staff where empname like CAST(USER as VARCHAR(30));
> EMPNAME
> ------------------------------
> APP
> 1 row selected
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (DERBY-2956) With a collated database USER cannot
be used in query against user tables without cast
Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-2956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513931 ]
Mamta A. Satoor commented on DERBY-2956:
----------------------------------------
Kathey, USER is defined to take the collation of UCS_BASIC. Here is the relevant informaiton copied from http://wiki.apache.org/db-derby/BuiltInLanguageBasedOrderingDERBY-1478 (note that USER is a synonym for CURRENT_USER)
9)For CURRENT_USER, SESSION_USER, SYSTEM_USER, SQL spec Section 6.4 Syntax Rule 4 says that their collation type is the collation of character set SQL_IDENTIFIER. In Derby's case, that will mean, the collation of these functions will be UCS_BASIC. The collation derivation will be implicit.
> With a collated database USER cannot be used in query against user tables without cast
> --------------------------------------------------------------------------------------
>
> Key: DERBY-2956
> URL: https://issues.apache.org/jira/browse/DERBY-2956
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.4.0.0
> Reporter: Kathey Marsden
>
> ij> create table staff (empname varchar(30));
> 0 rows inserted/updated/deleted
> ij> insert into staff values('APP');
> 1 row inserted/updated/deleted
> ij> insert into staff values('KATHEY');
> 1 row inserted/updated/deleted
> ij> select * from staff where empname like USER;
> ERROR 42ZA2: Operand of LIKE predicate with type VARCHAR(30) and collation TERRITORY_BASED is not compatable with LIKE p
> attern operand with type VARCHAR(128) and collation UCS_BASIC.
> ij>
> Workaround is to use a cast
> ij> select * from staff where empname like CAST(USER as VARCHAR(30));
> EMPNAME
> ------------------------------
> APP
> 1 row selected
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.