db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta A. Satoor (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2956) With a collated database USER cannot be used in query against user tables without cast
Date Thu, 19 Jul 2007 16:05:06 GMT

    [ 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.


Mime
View raw message