db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-5130) Allow for LONG VARCHAR to be compared to LONG VARCHAR
Date Sun, 13 Mar 2011 01:07:59 GMT

    [ https://issues.apache.org/jira/browse/DERBY-5130?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006121#comment-13006121
] 

Rick Hillegas commented on DERBY-5130:
--------------------------------------

Hi Lukas,

For the same reason, you can't build an index on a long varchar column or use it in any of
the SQL ordering contexts (ORDER BY clauses, GROUP BY clauses, etc.). The workaround is to
cast long varchar to varchar(32672):

connect 'jdbc:derby:memory:db;create=true';

create table t( a long varchar, b long varchar );

-- fails because the datatype is not orderable
select * from t where a = b;

-- succeeds although you may get truncation errors at runtime
select * from t where cast( a as varchar(32672) ) = cast( b as varchar(32672) );


> Allow for LONG VARCHAR to be compared to LONG VARCHAR
> -----------------------------------------------------
>
>                 Key: DERBY-5130
>                 URL: https://issues.apache.org/jira/browse/DERBY-5130
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.7.1.1
>            Reporter: Lukas Eder
>            Priority: Minor
>              Labels: comparison, derby_triage10_8, sql, typesystem
>
> Interestingly, this is not possible:
>   select 1 from SYSIBM.SYSDUMMY1 where cast('2' as long varchar) = cast('2' as long varchar)
> Whereas these statements are executable:
>   select 1 from SYSIBM.SYSDUMMY1 where '2' = '2'
>   select 1 from SYSIBM.SYSDUMMY1 where cast(cast('2' as long varchar) as varchar(1))
= cast(cast('2' as long varchar) as varchar(1))
> According to the documentation that is the correct behaviour:
> http://db.apache.org/derby/docs/10.7/ref/rrefsqlj58560.html
> Nevertheless, if casting is possible between LONG VARCHAR and VARCHAR, and assignment
too, then I don't understand why LONG VARCHAR cannot even be compared to LONG VARCHAR
> Note: A similar issue has been open for a long time:
> https://issues.apache.org/jira/browse/DERBY-342

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message