tracker issue : CF-3146604

select a category, or use search below
(searches all categories and all time range)
Title:

QoQ getting ccolumn data type wrong

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 03/23/2012

Components: Database, Query-of-Query(IMQ)

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: 9.0 / 287558

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Win XP All

Vote Count: 0

G'day:
What do you make of this:

[code]

<cfflush>
<cfset qBase = queryNew("")>
<cfset queryAddColumn(qBase, "myCol", "Double", [1,2.5,3.25])>
<cftry>
    <cfquery name="qAvg" dbtype="query">
        SELECT  AVG(myCol) AS avgMyCol
        FROM    qBase
    </cfquery>
    <cfdump var="#variables#">
    <cfcatch>
        <cfdump var="#getMetadata(qBase)#"><!---says the myCol column is a DOUBLE --->
        <cfrethrow>
    </cfcatch>
</cftry>
[/code]

Yields:

[quote]
Error casting an object of type java.lang.String cannot be cast to java.lang.Number to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed.
java.lang.String cannot be cast to java.lang.Number
[/quote]

However the getMetadata() call yields this:
[quote]
1	
struct
IsCaseSensitive	 NO
Name	 myCol
[color=red]TypeName	 DOUBLE[/color]
[/quote]

So:
a) why the error?
b) read the error message carefully:
[quote]
Error casting an object of type java.lang.String cannot be cast to java.lang.Number to an incompatible type.
[/quote]

Err... that's not English.

In case someone is wondering... yep, it's the same on CF9 and CF10.

-- 
Adam

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3146604

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Related to this: [QUOTE Adam Cameron] The next challenge is that I really want the result to be just the integer part, so tried this: [code] SELECT CAST(AVG(CAST(myCol AS DOUBLE)) AS INTEGER) AS avgMyCol [/code] Which now yields: [quote] Error casting an object of type coldfusion.sql.imq.TableListIterator cannot be cast to coldfusion.sql.imq.GroupTableListIterator to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed. coldfusion.sql.imq.TableListIterator cannot be cast to coldfusion.sql.imq.GroupTableListIterator [/quote] [/QUOTE]
Comment by External U.
20003 | March 23, 2012 06:44:12 AM GMT
Risky to take up for this release. We'll consider for the next.
Comment by Rupesh K.
20004 | March 26, 2012 05:24:39 AM GMT
This issue has been fixed and will be available in the next major release.
Comment by Nimit S.
20005 | January 03, 2014 09:02:42 AM GMT
Nice one! Cheers. -- Adam
Comment by External U.
20006 | January 03, 2014 09:13:47 AM GMT