db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Digulla (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4071) AssertFailure when selecting rows from a table with CHARACTER and VARCHAR columns
Date Wed, 04 Mar 2009 10:09:58 GMT

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

Aaron Digulla commented on DERBY-4071:
--------------------------------------

I tried that and I got lots of other, weird errors. I've extended the test case.

First of all, you need to give the inner select a name or the SQL won't parse.

And after giving it a name, I get an error because S.VCHR is no longer known in the inner
select. The final fix is this:

SELECT *
FROM DEMO.TEST S
WHERE S.VCHR IN (
        SELECT   T1.VCHR
        FROM     DEMO.TEST T1
        GROUP BY T1.VCHR
        HAVING   COUNT (T1.VCHR) > 1 
)
  AND S.CHR NOT IN ( select x.a from (
        SELECT   MAX(T2.CHR) as a, COUNT(T2.VCHR) as b, T2.VCHR as c
        FROM     DEMO.TEST T2
        GROUP BY T2.VCHR
        HAVING   COUNT(T2.VCHR) > 1  
) as x WHERE    S.VCHR = x.c )

... drumroll ... which fails with the same error.

> AssertFailure when selecting rows from a table with CHARACTER and VARCHAR columns
> ---------------------------------------------------------------------------------
>
>                 Key: DERBY-4071
>                 URL: https://issues.apache.org/jira/browse/DERBY-4071
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.4.2.0
>            Reporter: Aaron Digulla
>
> When running a complex query on this table:
> [code]
> Create table DEMO.TEST (
>     CHR                            CHARACTER(26)                   ,
>     VCHR                           VARCHAR(25)                     )
> [code]
> then I get this exception:
> AssertFailure: ASSERT FAILED col1.getClass() (class ...SQLChar) expected to be the same
as col2.getClass() (class ....SQLVarchar)' was thrown while evaluating an expression.

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