db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4071) AssertFailure when selecting rows from a table with CHARACTER and VARCHAR columns
Date Mon, 02 Mar 2009 15:19:56 GMT

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

Bryan Pendleton commented on DERBY-4071:
----------------------------------------

I suspect you're right Aaron, it's some sort of a column mixup. During compilation, Derby
converts table and column references from their string form in the SQL text into an
internal numeric form which represents columns as ordinal positions into number
result sets in the query plan. Some parts of this conversion are extremely tricky, and
there have been bugs in this area in the past.

In particular, I find it interesting that your queries reference an expression in the HAVING
clause, and that expression does not also appear in the SELECT clause.

Does it change anything if you rewrite your query so that the HAVING expression also
appears in the SELECT list? I think this might require you to introduce yet another level
of sub-selects, so that you'd end up with something like:

    AND CHR NOT IN ( select a from (
        SELECT MAX(CHR) as a, count(t.vchr) as b
        FROM DEMO.TEST T
        WHERE S.VCHR = T.VCHR
        GROUP BY T.VCHR
        HAVING COUNT(T.VCHR) > 1 ) )




> 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
>         Attachments: DerbyTest.java
>
>
> 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